Open insidewhy opened 8 years ago
Thanks, I will rename the package to something more appropriate. Do you have any suggestions? promise-throttle
is already taken (it has rate-limiting semantics, rather than "first wins").
Generally people will want to throttle according to a time period rather than due to completion of the corresponding promise and this is how throttle/debounce is implemented in every library I've used (lodash, underscore, Kefir, Bacon.js and rx.js).
To me your use case maybe feels like "atMostOneRunning" rather than "throttle" maybe.
@jaz303 i fall into this issue because i used your library thinking it did a debounce on promises :(. Rename it please or actually implement debounce instead of current behaviour
Debounce would need the ability to cancel initiated promises, a debounce should return the latest complete call.
What you have here is a throttle.