Skip to content
Buy me a coffee

EnhancedAbortSignal

const EnhancedAbortSignal: object

Defined in: src/EnhancedAbortSignal.ts:10

Helpers for any AbortSignal, including ones you didn’t create (fetch, frameworks, AbortSignal.timeout). Every function returns or accepts real AbortSignals.

none: AbortSignal

A signal that never aborts, always the same object. Use as a default for optional signals.

get aborted(): AbortSignal

A new, already-aborted signal (reason: an AbortError DOMException).

AbortSignal

any(signals): AbortSignal

AbortSignal.any, skipping undefined/null (optional signals) and none. The native implementation releases its links when the result is garbage-collected, so per-request use on a long-lived signal doesn’t leak.

Iterable<AbortSignal | null | undefined>

AbortSignal

canBeAborted(signal): boolean

False only for EnhancedAbortSignal.none: whether the signal can ever abort. .NET’s CanBeCanceled.

AbortSignal

boolean

register(signal, callback): AbortRegistration

See register().

AbortSignal

(reason) => void

AbortRegistration

timeout(delay): AbortSignal

AbortSignal.timeout that also accepts a TimeSpan, Infinity (returns none) and delays over 24.8 days. Aborts with a TimeoutError; never keeps the process alive.

Delay

AbortSignal

whenAborted(signal): Promise<unknown>

See whenAborted().

AbortSignal

Promise<unknown>