Skip to main content

interface Task.Job<R>

Represents a running Task that can be joined or cancelled.

Type parameters

NameDefaultDescription
Rvoidundocumented

Properties

cancel

Cancels the job if it is still running.

Definition

cancel: () => void;

join

Waits for the job to finish, and returns the result if available. If the job is already completed, returns the result immediately. If the job is cancelled, throws a CancellationError unless a recover function is provided.

Definition

join: <RT = never>(options?: {
      timeoutMs?: number;
      recover?: (error?: unknown) => RT;
    }) => Promise<R | RT>;

Methods

cancelAndJoin

Cancels the job and waits for it to finish.

Definition

cancelAndJoin(): Promise<void>;