p-cancelable
Advanced tools
Comparing version 2.0.0 to 2.1.0
10
index.js
@@ -35,4 +35,6 @@ 'use strict'; | ||
const onResolve = value => { | ||
this._isPending = false; | ||
resolve(value); | ||
if (!this._isCanceled || !onCancel.shouldReject) { | ||
this._isPending = false; | ||
resolve(value); | ||
} | ||
}; | ||
@@ -84,2 +86,4 @@ | ||
this._isCanceled = true; | ||
if (this._cancelHandlers.length > 0) { | ||
@@ -92,6 +96,6 @@ try { | ||
this._reject(error); | ||
return; | ||
} | ||
} | ||
this._isCanceled = true; | ||
if (this._rejectOnCancel) { | ||
@@ -98,0 +102,0 @@ this._reject(new CancelError(reason)); |
{ | ||
"name": "p-cancelable", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Create a promise that can be canceled", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -1,2 +0,2 @@ | ||
# p-cancelable [![Build Status](https://travis-ci.org/sindresorhus/p-cancelable.svg?branch=master)](https://travis-ci.org/sindresorhus/p-cancelable) | ||
# p-cancelable | ||
@@ -7,2 +7,3 @@ > Create a promise that can be canceled | ||
*If you target [Node.js 15](https://medium.com/@nodejs/node-js-v15-0-0-is-here-deb00750f278) or later, this package is [less useful](https://github.com/sindresorhus/p-cancelable/issues/27) and you should probably use [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) instead.* | ||
@@ -15,3 +16,2 @@ ## Install | ||
## Usage | ||
@@ -53,3 +53,2 @@ | ||
## API | ||
@@ -89,3 +88,3 @@ | ||
### PCancelable#cancel([reason]) | ||
### PCancelable#cancel(reason?) | ||
@@ -138,3 +137,2 @@ Type: `Function` | ||
## FAQ | ||
@@ -150,3 +148,8 @@ | ||
## p-cancelable for enterprise | ||
Available as part of the Tidelift Subscription. | ||
The maintainers of p-cancelable and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-p-cancelable?utm_source=npm-p-cancelable&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) | ||
## Related | ||
@@ -157,6 +160,1 @@ | ||
- [More…](https://github.com/sindresorhus/promise-fun) | ||
## License | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
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
13538
238
154