JS Task API Reference

Class: Task<OutputType>

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
OutputTypeunknown

Implements

  • QueueableTask

Table of contents

Constructors

Properties

Methods

Constructors

constructor

• new Task<OutputType>(id, worker, options?)

Type parameters

NameType
OutputTypeunknown

Parameters

NameType
idstring
workerWorker<OutputType>
options?TaskOptions

Defined in

src/task.ts:81

Properties

retryOnTimeout

• Readonly retryOnTimeout: boolean

Defined in

src/task.ts:70


id

• Readonly id: string

Implementation of

QueueableTask.id

Defined in

src/task.ts:82

Methods

onStateChange

â–¸ onStateChange(listener): void

Parameters

NameType
listener(state: TaskState) => void

Returns

void

Defined in

src/task.ts:98


cleanup

â–¸ cleanup(): void

Returns

void

Defined in

src/task.ts:101


init

â–¸ init(): void

Returns

void

Defined in

src/task.ts:105


start

â–¸ start(activity, networkNode?): void

Parameters

NameType
activityActivity
networkNode?NetworkNode

Returns

void

Defined in

src/task.ts:122


stop

â–¸ stop(results?, error?, retry?): void

Parameters

NameTypeDefault value
results?OutputTypeundefined
error?Errorundefined
retrybooleantrue

Returns

void

Defined in

src/task.ts:137


isQueueable

â–¸ isQueueable(): boolean

Returns

boolean

Implementation of

QueueableTask.isQueueable

Defined in

src/task.ts:157


isRetry

â–¸ isRetry(): boolean

Returns

boolean

Defined in

src/task.ts:160


isDone

â–¸ isDone(): boolean

Returns

boolean

Defined in

src/task.ts:163


isFinished

â–¸ isFinished(): boolean

Returns

boolean

Defined in

src/task.ts:166


isRejected

â–¸ isRejected(): boolean

Returns

boolean

Defined in

src/task.ts:169


isQueued

â–¸ isQueued(): boolean

Returns

boolean

Defined in

src/task.ts:172


isPending

â–¸ isPending(): boolean

Returns

boolean

Defined in

src/task.ts:175


isNew

â–¸ isNew(): boolean

Returns

boolean

Defined in

src/task.ts:178


isFailed

â–¸ isFailed(): boolean

Returns

boolean

Defined in

src/task.ts:181


getResults

â–¸ getResults(): undefined | OutputType

Returns

undefined | OutputType

Defined in

src/task.ts:184


getWorker

â–¸ getWorker(): Worker<OutputType>

Returns

Worker<OutputType>

Defined in

src/task.ts:187


getActivityReadySetupFunctions

â–¸ getActivityReadySetupFunctions(): Worker<unknown>[]

Returns

Worker<unknown>[]

Defined in

src/task.ts:190


getRetriesCount

â–¸ getRetriesCount(): number

Returns

number

Defined in

src/task.ts:193


getError

â–¸ getError(): undefined | Error

Returns

undefined | Error

Defined in

src/task.ts:196


getActivity

â–¸ getActivity(): undefined | Activity

Returns

undefined | Activity

Defined in

src/task.ts:199


getNetworkNode

â–¸ getNetworkNode(): undefined | NetworkNode

Returns

undefined | NetworkNode

Defined in

src/task.ts:202


getState

â–¸ getState(): TaskState

Returns

TaskState

Defined in

src/task.ts:205


getDetails

â–¸ getDetails(): TaskDetails

Returns

TaskDetails

Defined in

src/task.ts:214