Interface TaskRef<TInput, TOutput, TProgress>

Type Parameters

Hierarchy

  • TaskRef

Properties

completed: Promise<void>

A promise representing when the task has settled (either resolved or rejected). This completed promise will never reject.

completedAt: undefined | number

UNIX timestamp for the time at which this task was completed.

error: undefined | TaskFailureError

The task failure error with which the task was rejected, only set when the task did not succeed.

id: string

A unique identifier for the task.

output: undefined | TOutput

The task's result, only set when the task has completed successfully.

queuedAt: number

UNIX timestamp for the time at which this task was enqueued.

request: TaskRequest<TInput>

The options used when requesting the task, including input arguments.

signal: AbortSignal

A signal communicating the requested cancellation of this task.

state: TaskState

The current state of this task in the execution lifecycle.

Methods

  • A function that aborts the task's execution.

    Parameters

    • Optional reason: unknown

    Returns void

  • A function that emits progress events to consumers.

    Parameters

    • name: "progress"
    • event: TProgress

    Returns void

  • A function that removes an event listener for progress events.

    Parameters

    • name: "progress"
    • listener: ((event) => void)
        • (event): void
        • Parameters

          • event: TProgress

          Returns void

    Returns void

  • A function that adds an event listener for progress events.

    Parameters

    • name: "progress"
    • listener: ((event) => void)
        • (event): void
        • Parameters

          • event: TProgress

          Returns void

    Returns void

Generated using TypeDoc