"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CompositeAbortSignal = void 0; const fast_abort_controller_1 = require("fast-abort-controller"); // AbortSignal classes must be named "AbortSignal" to work with node-fetch.. class AbortSignal extends fast_abort_controller_1.FastAbortSignal { constructor(signals) { super(); this.signals = new Set(); this.handleAbort = () => { if (this.aborted) return; // @ts-ignore this.aborted = [...this.signals].every((signal) => signal.aborted); if (this.aborted) { const event = typeof Event != 'undefined' ? new Event('abort') : { type: 'abort' }; this.dispatchEvent(event); } }; if (signals != null) { for (const signal of signals) { this.add(signal); } // @ts-ignore this.aborted = [...this.signals].every((signal) => signal.aborted); } } add(signal) { const self = this; this.signals.add(signal); // @ts-ignore this.aborted = this.aborted && signal.aborted; if (signal.aborted === true) return; signal.addEventListener('abort', function handleAbort() { signal.removeEventListener('abort', handleAbort); self.handleAbort(); }); } } exports.CompositeAbortSignal = AbortSignal; class CompositeAbortController extends fast_abort_controller_1.FastAbortController { constructor(signals) { super(); this.signal = new exports.CompositeAbortSignal(signals); } addSignal(signal) { this.signal.add(signal); } } exports.default = CompositeAbortController; //# sourceMappingURL=index.js.map