1.0.0 • Published 3 years ago

@jswork/next-make-cancelable v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

next-make-cancelable

Make promise cancelable for next.

version license size download

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.