data-cancel-token
v0.5.3
Published
Simple TypeScript/ES2015 class to emulate cancellation tokens
Downloads
5,222
Maintainers
Readme
Cancel Token
Simple TypeScript/ES2015 class to emulate cancellation tokens. Does not fully comply yet with the proposed specification.
Installation
npm install --save data-cancel-token
Usage
import { CancelToken } from 'data-cancel-token';
const token = new CancelToken();
console.log( token.cancellationRequested );
token.cancellationPromise.then( () => console.log( 'cancelled' ) );
token.throwIfCancellationRequested();
token.cancel();