Function: raceWithAbort()
raceWithAbort<
T
>(operation
:Promise
<T
>,signal
:AbortSignal
):Promise
<T
>
Defined in: shared/utils/abortUtils.ts:375
Creates a race condition between an operation and an abort signal.
Type Parametersโ
Tโ
T
Parametersโ
operationโ
Promise
<T
>
Promise to race
signalโ
AbortSignal to race against
Returnsโ
Promise
<T
>
Promise that resolves to the operation result or rejects if aborted
Remarksโ
Useful for operations that don't natively support AbortSignal. The operation will be raced against the abort signal.
Exampleโ
const controller = new AbortController();
const result = await raceWithAbort(
someNonAbortableOperation(),
controller.signal
);