UNPKG

abort-utils

Version:

Utility functions to use and combine `AbortSignal` and `AbortController` with Promises

16 lines (15 loc) 468 B
export class ReusableAbortController { controller = new AbortController(); get signal() { return this.controller.signal; } abortAndReset(reason) { this.controller.abort(reason); this.controller = new AbortController(); } } /** * @deprecated Use `ReusableAbortController` instead. */ // eslint-disable-next-line @typescript-eslint/naming-convention -- Class export const RepeatableAbortController = ReusableAbortController;