3 ms·
Why are you generating the promise in the first place if there are no listeners? Why don't you return a function which can be used to generate the promise inste
by kevincox 9y ago
Why are you generating the promise in the first place if there are no listeners? Why don't you return a function which can be used to generate the promise instead?
- amelius 9y agoI'm not sure what would be the advantage. The number of listeners can go up and down during the computation. When that number reaches zero, the computation needs to be stopped. When the number becomes nonzero again, the computation needs to be restarted. Those are the requirements, basically.