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
Name | Type |
---|---|
InputType | unknown |
OutputType | unknown |
Implements
QueueableTask
Table of contents
Constructors
Properties
Methods
- onStateChange
- cleanup
- start
- stop
- isQueueable
- isRetry
- isDone
- isFinished
- isRejected
- isPending
- isNew
- getResults
- getData
- getWorker
- getInitWorker
- getRetriesCount
- getError
Constructors
constructor
• new Task<InputType
, OutputType
>(id
, worker
, data?
, initWorker?
, options?
)
Type parameters
Name | Type |
---|---|
InputType | unknown |
OutputType | unknown |
Parameters
Name | Type |
---|---|
id | string |
worker | Worker <InputType , OutputType > |
data? | InputType |
initWorker? | Worker <undefined > |
options? | TaskOptions |
Defined in
Properties
id
• Readonly
id: string
Defined in
Methods
onStateChange
▸ onStateChange(listener
): void
Parameters
Name | Type |
---|---|
listener | (state : TaskState ) => void |
Returns
void
Defined in
cleanup
▸ cleanup(): void
Returns
void
Defined in
start
▸ start(): void
Returns
void
Defined in
stop
▸ stop(results?
, error?
, retry?
): void
Parameters
Name | Type | Default value |
---|---|---|
results? | OutputType | undefined |
error? | Error | undefined |
retry | boolean | true |
Returns
void
Defined in
isQueueable
▸ isQueueable(): boolean
Returns
boolean
Implementation of
QueueableTask.isQueueable
Defined in
isRetry
▸ isRetry(): boolean
Returns
boolean
Defined in
isDone
▸ isDone(): boolean
Returns
boolean
Defined in
isFinished
▸ isFinished(): boolean
Returns
boolean
Defined in
isRejected
▸ isRejected(): boolean
Returns
boolean
Defined in
isPending
▸ isPending(): boolean
Returns
boolean
Defined in
isNew
▸ isNew(): boolean
Returns
boolean
Defined in
getResults
▸ getResults(): undefined
| OutputType
Returns
undefined
| OutputType
Defined in
getData
▸ getData(): undefined
| InputType
Returns
undefined
| InputType
Defined in
getWorker
▸ getWorker(): Worker
<InputType
>
Returns
Worker
<InputType
>
Defined in
getInitWorker
▸ getInitWorker(): undefined
| Worker
<undefined
>
Returns
undefined
| Worker
<undefined
>
Defined in
getRetriesCount
▸ getRetriesCount(): number
Returns
number
Defined in
getError
▸ getError(): undefined
| Error
Returns
undefined
| Error