Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 507 Bytes

README.md

File metadata and controls

23 lines (15 loc) · 507 Bytes

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();