@jswork/next-make-cancelable

1.0.0 • Public • Published

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.

Package Sidebar

Install

npm i @jswork/next-make-cancelable

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

5.28 kB

Total Files

5

Last publish

Collaborators

  • afeiship