promise-cancellation
Nice cancellation for any Promise/A+ implementation
- "Cancelled" promises are forever 'pending'
- Can be used with any Promise/A+
Install
As usual:
yarn add promise-cancellation
or
npm install promise-cancellation
Example
; { const cancellation = ; ; if youChangedYourMind cancellation; } { return // will hang if cancelled, otherwise will act as identity ;} { await ; // as above, this will never resolve if cancelled await cancellationToken; await ;} { await ; if cancellationToken return; await ;}