UNPKG

abort-utils

Version:

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

11 lines (10 loc) 267 B
export class ReusableAbortController { controller = new AbortController(); get signal() { return this.controller.signal; } abortAndReset(reason) { this.controller.abort(reason); this.controller = new AbortController(); } }