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

Aborts the run and reports what was there — Elixir's Task.shutdown/2. Fires the Executor's AbortSignal, so work that was handed it — a fetch(url, { signal }) — stops; JS cannot preempt work that ignores it, which finishes detached. Then yields for timeoutMs: the settled Result if one landed, else null after settling the task with a declared Failure('Shutdown') so every consumer resolves.

A Recipe declares no parameters and so never sees the signal — it cannot be interrupted, only abandoned. Take the executor shape for work that should stop.

const slow = Task<number>((resolve, _reject, signal) => {
  const timer = setTimeout(() => resolve(1), 60_000);
  signal.addEventListener('abort', () => clearTimeout(timer));
});
slow.perform();

await slow.shutdown(10); // null — nothing had landed, and the timer was cleared

Parameters

optional
timeoutMs: number = 5000

Return Type

Promise<Result<T, E> | null>

Usage

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