Utility functions to use and combine
AbortSignalandAbortControllerwith Promises
npm install abort-utils
import {
onAbort,
mergeSignals,
linkControllers,
promiseFromSignal,
ReusableAbortController
} from 'abort-utils';
This package exports various utilities, just import what you need.
AbortSignal.timeout(), but it throws a TimeoutError with a customizable message.AbortSignal that is aborted when an event is dispatched.AbortSignal that is aborted when a Promise is resolved or rejected.AbortController, but it generates a new signal after it's aborted.Here's a visual representation that might help understand how some of the methods differ and behave.
MIT © Federico Brigante
55 commits
1 commits
TypeScript
100.0%
Utility functions to use and combine
AbortSignalandAbortControllerwith Promises
npm install abort-utils
import {
onAbort,
mergeSignals,
linkControllers,
promiseFromSignal,
ReusableAbortController
} from 'abort-utils';
This package exports various utilities, just import what you need.
AbortSignal.timeout(), but it throws a TimeoutError with a customizable message.AbortSignal that is aborted when an event is dispatched.AbortSignal that is aborted when a Promise is resolved or rejected.AbortController, but it generates a new signal after it's aborted.Here's a visual representation that might help understand how some of the methods differ and behave.
MIT © Federico Brigante
55 commits
1 commits
TypeScript
100.0%