Runs multiple async tasks concurrently and resolves/rejects with the result of the first task that settles.
This is a thin wrapper around Promise.race for arrays of async task functions.
Promise.race
An array of functions returning promises.
A promise that resolves or rejects with the first task to settle.
const result = await raceAll([ () => fetch("/api/slow"), () => fetch("/api/fast")]);// Resolves as soon as the faster fetch completes Copy
const result = await raceAll([ () => fetch("/api/slow"), () => fetch("/api/fast")]);// Resolves as soon as the faster fetch completes
1.1.0
Runs multiple async tasks concurrently and resolves/rejects with the result of the first task that settles.
This is a thin wrapper around
Promise.race
for arrays of async task functions.