JS API Reference

Class: Task<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
OutputTypeunknown

Implements

  • QueueableTask

Table of contents

Constructors

Properties

Methods

Constructors

constructor

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

Type parameters

NameType
OutputTypeunknown

Parameters

NameType
idstring
workerWorker<OutputType>
options?TaskOptions

Returns

Task<OutputType>

Defined in

src/task/task.ts:48

Properties

id

Readonly id: string

Defined in

src/task/task.ts:49

Methods

onStateChange

onStateChange(listener): void

Parameters

NameType
listener(state: TaskState) => void

Returns

void

Defined in

src/task/task.ts:61


cleanup

cleanup(): void

Returns

void

Defined in

src/task/task.ts:64


init

init(): void

Returns

void

Defined in

src/task/task.ts:68


start

start(activity, networkNode?): void

Parameters

NameType
activityActivity
networkNode?NetworkNode

Returns

void

Defined in

src/task/task.ts:72


stop

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

Parameters

NameTypeDefault value
results?OutputTypeundefined
error?Errorundefined
retrybooleantrue

Returns

void

Defined in

src/task/task.ts:82


isQueueable

isQueueable(): boolean

Returns

boolean

Implementation of

QueueableTask.isQueueable

Defined in

src/task/task.ts:101


isRetry

isRetry(): boolean

Returns

boolean

Defined in

src/task/task.ts:104


isDone

isDone(): boolean

Returns

boolean

Defined in

src/task/task.ts:107


isFinished

isFinished(): boolean

Returns

boolean

Defined in

src/task/task.ts:110


isRejected

isRejected(): boolean

Returns

boolean

Defined in

src/task/task.ts:113


isQueued

isQueued(): boolean

Returns

boolean

Defined in

src/task/task.ts:116


isPending

isPending(): boolean

Returns

boolean

Defined in

src/task/task.ts:119


isNew

isNew(): boolean

Returns

boolean

Defined in

src/task/task.ts:122


isFailed

isFailed(): boolean

Returns

boolean

Defined in

src/task/task.ts:125


getResults

getResults(): undefined | OutputType

Returns

undefined | OutputType

Defined in

src/task/task.ts:128


getWorker

getWorker(): Worker<OutputType>

Returns

Worker<OutputType>

Defined in

src/task/task.ts:131


getActivityReadySetupFunctions

getActivityReadySetupFunctions(): Worker<unknown>[]

Returns

Worker<unknown>[]

Defined in

src/task/task.ts:134


getRetriesCount

getRetriesCount(): number

Returns

number

Defined in

src/task/task.ts:137


getError

getError(): undefined | Error

Returns

undefined | Error

Defined in

src/task/task.ts:140


getActivity

getActivity(): undefined | Activity

Returns

undefined | Activity

Defined in

src/task/task.ts:143


getNetworkNode

getNetworkNode(): undefined | NetworkNode

Returns

undefined | NetworkNode

Defined in

src/task/task.ts:146