createTimeoutSignal
function createTimeoutSignal( callerSignal, timeoutMs, label): { cleanup: () => void; signal: AbortSignal;};Defined in: packages/engine/src/utilities/TimeoutSignal.ts:13
Multiplex an optional caller AbortSignal with a hard timeout into a single AbortSignal suitable for fetch().
Implemented manually rather than with AbortSignal.any()/AbortSignal.timeout() (Chrome 116+) to stay compatible with the TypeScript lib targets used by this project.
Handles the already-aborted caller: addEventListener(“abort”, …) on a signal
that has already fired never invokes the listener, so without the upfront
aborted check the fetch would proceed even though the caller cancelled.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
callerSignal | AbortSignal | undefined |
timeoutMs | number |
label | string |
Returns
Section titled “Returns”{ cleanup: () => void; signal: AbortSignal;}cleanup
Section titled “cleanup”cleanup: () => void;Returns
Section titled “Returns”void
signal
Section titled “signal”signal: AbortSignal;