@jswork/next-make-cancelable
v1.0.0
Published
Make promise cancelable for next.
Downloads
3
Maintainers
Readme
next-make-cancelable
Make promise cancelable for next.
installation
npm install -S @jswork/next-make-cancelable
usage
import '@jswork/next-make-cancelable';
const somePromise = new Promise(r => setTimeout(r, 1000));
const cancelable = nx.makeCancelable(somePromise);
cancelable
.promise
.then(() => console.log('resolved'))
.catch(({isCanceled, ...error}) => console.log('isCanceled', isCanceled));
// Cancel promise
cancelable.cancel();
license
Code released under the MIT license.