method TaskClass.prototype.yield
Private
TaskClass.prototype.yield(timeoutMs?: number): Promise<Result<T, E> | null>

Non-destructive poll — Elixir's Task.yield/2: settles to the task's Result if it finishes within the window, or null if it is still running. Never consumes: the memo persists, so a later yield, await, or result() still sees the outcome. A bug rejection still rethrows (the two-tier gate is result()'s).

const task = Task(() => 7);
await task.yield(50); // 7 — settled within the window, bare
const slow = Task(() => new Promise<never>(() => {}));
await slow.yield(10); // null — still running, NOT consumed

Parameters

optional
timeoutMs: number = 5000

Return Type

Promise<Result<T, E> | null>

Usage

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