The tasks to race against each other.
Given an array of tasks, produce a new Task
which will resolve or
reject with the resolution or rejection of the first task which settles.
import Task, { race } from 'true-myth/task';
let { task: task1, resolve } = Task.withResolvers();
let task2 = new Task((_resolve) => {});
let task3 = new Task((_resolve) => {});
resolve("Cool!");
let theResult = await race([task1, task2, task3]);
console.log(theResult.toString()); // Ok("Cool!")
The tasks to race against each other.
Given an array of tasks, produce a new
Task
which will resolve or reject with the resolution or rejection of the first task which settles.Example