cancelable-promise
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -15,3 +15,2 @@ export default class CancelablePromise { | ||
constructor(executor) { | ||
let superResolve, superReject; | ||
this._promise = new Promise(executor); | ||
@@ -18,0 +17,0 @@ |
@@ -37,4 +37,2 @@ "use strict"; | ||
var superResolve = void 0, | ||
superReject = void 0; | ||
this._promise = new Promise(executor); | ||
@@ -41,0 +39,0 @@ |
{ | ||
"name": "cancelable-promise", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "A simple cancelable promise", | ||
@@ -5,0 +5,0 @@ "main": "dist/CancelablePromise.js", |
@@ -13,7 +13,12 @@ # CancelablePromise | ||
## Usage | ||
CancelablePromise acts like a ES6 Promise: you can use `Promise.all`, `Promise.race` with your CancelablePromise for example. The only difference is you'll have a `cancel` method on your promise to cancel future execution of `then` or `catch` functions. CancelablePromise will also cancel all callbacks attached to new promises returned by `then`/`catch`. | ||
``` | ||
var CancelablePromise = require('cancelable-promise'); | ||
var myPromise = new CancelablePromise((resolve, reject) => { ... }); | ||
myPromise.then((response) => { console.log('not canceled'); }); | ||
import CancelablePromise from 'cancelable-promise'; | ||
const myPromise = new CancelablePromise((resolve) => setTimeout(() => resolve('I\'m resolved'), 100)); | ||
myPromise.then((response) => console.log(response)).then(() => console.log('not cancel')); | ||
myPromise.cancel(); | ||
// Nothing will be displayed in console | ||
``` | ||
## Test | ||
You can run tests with `npm run test` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27313
24
256