Takes an array of tasks and returns a promise that resolves as soon as any of the tasks resolves. If all tasks reject, it rejects with an AggregateError.
Cancellable configuration options.
The tasks to execute.
A cancellable handle that resolves with the first successful task's result.
const handle = any( {}, async () => { throw new Error("failed"); }, async (token) => { await token.sleep(10); return "ok"; },);const result = await handle; // "ok" Copy
const handle = any( {}, async () => { throw new Error("failed"); }, async (token) => { await token.sleep(10); return "ok"; },);const result = await handle; // "ok"
Takes an array of tasks and returns a promise that resolves as soon as any of the tasks resolves. If all tasks reject, it rejects with an AggregateError.