AbortSignal.any()

A function that combines several signals into one that aborts as soon as any of them does.

In more detail

The combined signal's reason is the reason of whichever input aborted first. AbortSignal.any([userCancel.signal, AbortSignal.timeout(5000)]) cancels on a click or a deadline, whichever comes first, replacing hand-written Promise.race logic.

Related terms

Taught in

References