Skip to content

Futurable.race()

Race multiple futurables.

Syntax

typescript
Futurable.race<T>(values: Iterable<T>): Futurable<T>

Example

typescript
const winner = await Futurable.race([
  Futurable.fetch('/api/fast'),
  Futurable.sleep(5000).then(() => { throw new Error('Timeout') })
]);

See Also

Released under the MIT License.