Skip to main content
Version: 0.17

Class: TaskProcessor<Type, Data, Options, Result>

A TaskProcessor performs a Task by calling perform() on its target. This is triggered by calling process() on the processor.

A processor maintains a promise that represents the eventual state (resolved or rejected) of the task. This promise is created upon construction, and will be returned by calling settle().

A task can be re-tried by first calling reset() on the processor. This will clear the processor's state and allow process() to be invoked again.

Type parameters​

NameType
Typestring
Dataunknown
Optionsunknown
Resultunknown

Constructors​

constructor​

• new TaskProcessor<Type, Data, Options, Result>(target, task)

Creates an instance of TaskProcessor.

Type parameters​

NameType
Typestring
Dataunknown
Optionsunknown
Resultunknown

Parameters​

NameType
targetPerformer<Type, Data, Options, Result>
taskTask<Type, Data, Options>

Defined in​

packages/@orbit/core/src/task-processor.ts:32

Properties​

target​

• target: Performer<Type, Data, Options, Result>

Defined in​

packages/@orbit/core/src/task-processor.ts:20


task​

• task: Task<Type, Data, Options>

Defined in​

packages/@orbit/core/src/task-processor.ts:21

Accessors​

settled​

• get settled(): boolean

Has promise settled, either via process or reject?

Returns​

boolean

Defined in​

packages/@orbit/core/src/task-processor.ts:71


started​

• get started(): boolean

Has process been invoked?

Returns​

boolean

Defined in​

packages/@orbit/core/src/task-processor.ts:64

Methods​

process​

â–¸ process(): Promise<Result>

Invokes perform on the target.

Returns​

Promise<Result>

Defined in​

packages/@orbit/core/src/task-processor.ts:85


reject​

â–¸ reject(e): void

Reject the current promise with a specific error.

Parameters​

NameType
eError

Returns​

void

Defined in​

packages/@orbit/core/src/task-processor.ts:98


reset​

â–¸ reset(): void

Clears the processor state, allowing for a fresh call to process().

Returns​

void

Defined in​

packages/@orbit/core/src/task-processor.ts:45


settle​

â–¸ settle(): Promise<Result>

The eventual result of processing.

Returns​

Promise<Result>

Defined in​

packages/@orbit/core/src/task-processor.ts:78