Interface Task<Data>Internal

Message object that is passed as a task between main worker and worker.

interface Task<Data> {
    data?: Data;
    name?: string;
    priority?: number;
    strategy?:
        | "FAIR_SHARE"
        | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
        | "LEAST_BUSY"
        | "LEAST_ELU"
        | "LEAST_USED"
        | "ROUND_ROBIN"
        | "WEIGHTED_ROUND_ROBIN";
    taskId?: `${string}-${string}-${string}-${string}-${string}`;
    timestamp?: number;
    transferList?: readonly TransferListItem[];
}

Type Parameters

  • Data = unknown

    Type of data sent to the worker. This can only be structured-cloneable data.

Hierarchy (view full)

Properties

data?: Data

Task input data that will be passed to the worker.

name?: string

Task name.

priority?: number

Task priority. Lower values have higher priority.

0
strategy?:
    | "FAIR_SHARE"
    | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
    | "LEAST_BUSY"
    | "LEAST_ELU"
    | "LEAST_USED"
    | "ROUND_ROBIN"
    | "WEIGHTED_ROUND_ROBIN"

Task worker choice strategy.

taskId?: `${string}-${string}-${string}-${string}-${string}`

Task UUID.

timestamp?: number

Timestamp.

transferList?: readonly TransferListItem[]

Array of transferable objects.