data-cancel-token
TypeScript icon, indicating that this package has built-in type declarations

0.5.3 • Public • Published

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

Package Sidebar

Install

npm i data-cancel-token

Weekly Downloads

315

Version

0.5.3

License

ISC

Unpacked Size

5.96 kB

Total Files

8

Last publish

Collaborators

  • pedromsilva