JS API Reference

Module: shared/utils/abortSignal

Table of contents

Functions

Functions

createAbortSignalFromTimeout

createAbortSignalFromTimeout(timeoutOrSignal): AbortSignal

If provided an AbortSignal, returns it. If provided a number, returns an AbortSignal that will be aborted after the specified number of milliseconds. If provided undefined, returns an AbortSignal that will never be aborted.

Parameters

NameType
timeoutOrSignalundefined | number | AbortSignal

Returns

AbortSignal

Defined in

src/shared/utils/abortSignal.ts:6


anyAbortSignal

anyAbortSignal(...signals): AbortSignal

Combine multiple AbortSignals into a single signal that will be aborted if any of the input signals are aborted. If any of the input signals are already aborted, the returned signal will be aborted immediately.

Polyfill for AbortSignal.any(), since it's only available starting in Node 20 https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/any_static

Parameters

NameType
...signalsAbortSignal[]

Returns

AbortSignal

Defined in

src/shared/utils/abortSignal.ts:24

Was this helpful?