Releases: alkemics/CancelablePromise
Releases · alkemics/CancelablePromise
3.1.0
3.0.0
- Complete rewrite of
CancelablePromise
.
Now promises returned fromPromise
API such asthen
orcatch
can cancel the root promise and all promises created from this root promise:
// CancelablePromise v2
import CancelablePromise from 'cancelable-promise';
const promise = new CancelablePromise((resolve) => setTimeout(resolve, 1))
.then(() => console.log('callback2 executed'))
.then(() => console.log('callback3 executed'));
promise.cancel();
// logs:
// callback2 executed
// callback3 executed
// CancelablePromise v3
import CancelablePromise from 'cancelable-promise';
const promise = new CancelablePromise((resolve) => setTimeout(resolve, 1))
.then(() => console.log('callback2 executed'))
.then(() => console.log('callback3 executed'));
promise.cancel();
// no logs
- a functionnal util has been added:
import { cancelable } from 'cancelable-promise';
cancelable(new Promise((resolve) => setTimeout(resolve, 1)));
- UMD module,
CancelablePromise
can be loaded in browser