Socket
Socket
Sign inDemoInstall

cancelable-promise

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cancelable-promise - npm Package Compare versions

Comparing version 2.1.1 to 2.1.2

1

CancelablePromise.js

@@ -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 @@

2

package.json
{
"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`
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc