awesome-only-resolves-last-promise
Install
npm install --save awesome-only-resolves-last-promise// oryarn add awesome-only-resolves-last-promise
Features
- Wraps an existing async function
- When calling the wrapped function multiple times consecutively, only the last returned promise will resolve and formerly returned promises will be cancelled (they won't resolve nor reject)
Usage
; ; ; ;;; // promise1 and promise2 will never resolve/reject// promise3 will resolve in 100ms
Useful as an implementation detail of awesome-debounce-promise.
License
MIT © slorber
Hire a freelance expert
Looking for a React/ReactNative freelance expert with more than 5 years production experience? Contact me from my website or with Twitter.