Gathering detailed insights and metrics for make-cancellable-promise
Gathering detailed insights and metrics for make-cancellable-promise
Gathering detailed insights and metrics for make-cancellable-promise
Gathering detailed insights and metrics for make-cancellable-promise
@permettezmoideconstruire/cancellable-promise
Non intrusive Promise wrapper to make it cancellable
vue-reactive-stateful-promise
Extends promises with their state, a timeout and make them cancellable, all of that vue reactive
trashable
A wrapper to make promises cancellable and garbage collectable
npm install make-cancellable-promise
Typescript
Module System
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
30 Stars
237 Commits
2 Forks
2 Watchers
5 Branches
1 Contributors
Updated on Jul 09, 2025
Latest Version
2.0.0
Package Id
make-cancellable-promise@2.0.0
Unpacked Size
7.46 kB
Size
2.87 kB
File Count
7
NPM Version
10.9.2
Node Version
22.14.0
Published on
Mar 20, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
5
Make any Promise cancellable.
npm install make-cancellable-promise
or yarn add make-cancellable-promise
.import makeCancellablePromise from 'make-cancellable-promise
.1const { promise, cancel } = makeCancellablePromise(myPromise);
A function that returns an object with two properties:
promise
and cancel
. promise
is a wrapped around your promise. cancel
is a function which stops .then()
and .catch()
from working on promise
, even if promise passed to makeCancellablePromise
resolves or rejects.
1const { promise, cancel } = makeCancellablePromise(myPromise);
Typically, you'd want to use makeCancellablePromise
in React components. If you call setState
on an unmounted component, React will throw an error.
Here's how you can use makeCancellablePromise
with React:
1function MyComponent() { 2 const [status, setStatus] = useState('initial'); 3 4 useEffect(() => { 5 const { promise, cancel } = makeCancellable(fetchData()); 6 7 promise.then(() => setStatus('success')).catch(() => setStatus('error')); 8 9 return () => { 10 cancel(); 11 }; 12 }, []); 13 14 const text = (() => { 15 switch (status) { 16 case 'pending': 17 return 'Fetching…'; 18 case 'success': 19 return 'Success'; 20 case 'error': 21 return 'Error!'; 22 default: 23 return 'Click to fetch'; 24 } 25 })(); 26 27 return <p>{text}</p>; 28}
The MIT License.
| Wojciech Maj |
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
0 existing vulnerabilities detected
Reason
7 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
Reason
Found 0/26 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More