Skip to content

afeiship/next-make-cancelable

Repository files navigation

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.

Releases

No releases published

Packages

No packages published