reference

Class: Task<InputType, OutputType>

task/task.Task

One computation unit.

Description

Represents one computation unit that will be run on the one provider machine (e.g. rendering of one frame of an animation).

Type parameters

NameType
InputTypeunknown
OutputTypeunknown

Implements

  • QueueableTask

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Task<InputType, OutputType>(id, worker, data?, initWorker?, options?)

Type parameters

NameType
InputTypeunknown
OutputTypeunknown

Parameters

NameType
idstring
workerWorker<InputType, OutputType>
data?InputType
initWorker?Worker<undefined>
options?TaskOptions

Defined in

src/task/task.ts:39

Properties

id

Readonly id: string

Defined in

src/task/task.ts:40

Methods

onStateChange

onStateChange(listener): void

Parameters

NameType
listener(state: TaskState) => void

Returns

void

Defined in

src/task/task.ts:50


cleanup

cleanup(): void

Returns

void

Defined in

src/task/task.ts:53


start

start(): void

Returns

void

Defined in

src/task/task.ts:58


stop

stop(results?, error?, retry?): void

Parameters

NameTypeDefault value
results?OutputTypeundefined
error?Errorundefined
retrybooleantrue

Returns

void

Defined in

src/task/task.ts:63


isQueueable

isQueueable(): boolean

Returns

boolean

Implementation of

QueueableTask.isQueueable

Defined in

src/task/task.ts:75


isRetry

isRetry(): boolean

Returns

boolean

Defined in

src/task/task.ts:78


isDone

isDone(): boolean

Returns

boolean

Defined in

src/task/task.ts:81


isFinished

isFinished(): boolean

Returns

boolean

Defined in

src/task/task.ts:84


isRejected

isRejected(): boolean

Returns

boolean

Defined in

src/task/task.ts:87


isPending

isPending(): boolean

Returns

boolean

Defined in

src/task/task.ts:90


isNew

isNew(): boolean

Returns

boolean

Defined in

src/task/task.ts:93


getResults

getResults(): undefined | OutputType

Returns

undefined | OutputType

Defined in

src/task/task.ts:96


getData

getData(): undefined | InputType

Returns

undefined | InputType

Defined in

src/task/task.ts:99


getWorker

getWorker(): Worker<InputType>

Returns

Worker<InputType>

Defined in

src/task/task.ts:102


getInitWorker

getInitWorker(): undefined | Worker<undefined>

Returns

undefined | Worker<undefined>

Defined in

src/task/task.ts:105


getRetriesCount

getRetriesCount(): number

Returns

number

Defined in

src/task/task.ts:108


getError

getError(): undefined | Error

Returns

undefined | Error

Defined in

src/task/task.ts:111