method TaskClass.yieldMany
Private
TaskClass.yieldMany<T, E>(
tasks: readonly TaskClass<T, E>[],
timeoutMs?: number
): Promise<(Result<T, E> | null)[]>

Elixir's Task.yield_many/2: polls every task under one shared window — each slot is the task's Result if it settled in time, null if still running. Nothing is consumed.

const fast = Task(() => 1);
const never = Task<number>(() => new Promise<never>(() => {}));
await Task.yieldMany([fast, never], 20); // [1, null] — bare Result | null per slot

Type Parameters

Parameters

tasks: readonly TaskClass<T, E>[]
optional
timeoutMs: number = 5000

Return Type

Promise<(Result<T, E> | null)[]>

Usage

import { TaskClass } from "lib/task/task.ts";