Skip to content

Commit

Permalink
pass through the cancellation function on the wrapped promise
Browse files Browse the repository at this point in the history
  • Loading branch information
splitice committed Nov 14, 2023
1 parent 063d5de commit 7403437
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ class CancellationState {
if(this._child)this._child.delete(cancelFn)
return a
}
return promise.then(doRemove, e=>{
const c = promise.then(doRemove, e=>{
doRemove()
throw e
})
c.cancel = cancelFn
return c
}
return promise
}
Expand Down

0 comments on commit 7403437

Please sign in to comment.