Skip to content

Class TaskRoutine

🏭 Constructors

constructor

ts
new TaskRoutine(name: string, executor: TaskExecutor<T>, param: object= {}): TaskRoutine<T>

Parameters

  • name: string
  • executor: TaskExecutor<T>
  • param: object

Return Type

  • TaskRoutine<T>

Defined in: packages/task/index.ts:350

🏷️ Properties

_from

ts
_from: undefined | string

Inherited from: TaskGroup._from

Defined in: packages/task/index.ts:80

_id

ts
_id: number = 0

Inherited from: TaskGroup._id

Defined in: packages/task/index.ts:85

_path

ts
_path: string = ''

Inherited from: TaskGroup._path

Defined in: packages/task/index.ts:84

_progress

ts
_progress: number = 0

Inherited from: TaskGroup._progress

Defined in: packages/task/index.ts:82

_promise

ts
_promise: Promise<T>

Inherited from: TaskGroup._promise

Defined in: packages/task/index.ts:75

_state

ts
_state: TaskState = TaskState.Idle

Inherited from: TaskGroup._state

Defined in: packages/task/index.ts:74

_to

ts
_to: undefined | string

Inherited from: TaskGroup._to

Defined in: packages/task/index.ts:81

_total

ts
_total: number = -1

Inherited from: TaskGroup._total

Defined in: packages/task/index.ts:83

children

ts
children: Task<any>[] = []

Inherited from: TaskGroup.children

Defined in: packages/task/index.ts:285

context

ts
context: TaskContext = {}

Inherited from: TaskGroup.context

Defined in: packages/task/index.ts:88

executor

ts
executor: TaskExecutor<T>

Defined in: packages/task/index.ts:350

name

ts
name: string = ''

Inherited from: TaskGroup.name

Defined in: packages/task/index.ts:90

param

ts
param: object = {}

Inherited from: TaskGroup.param

Defined in: packages/task/index.ts:91

parent

ts
parent: undefined | Task<any>

Inherited from: TaskGroup.parent

Defined in: packages/task/index.ts:87

reject

ts
reject: Function

Inherited from: TaskGroup.reject

Defined in: packages/task/index.ts:78

resolve

ts
resolve: Function

Inherited from: TaskGroup.resolve

Defined in: packages/task/index.ts:77

resultOrError

ts
resultOrError: any

Inherited from: TaskGroup.resultOrError

Defined in: packages/task/index.ts:93

🔑 Accessors

from

Inherited from: TaskGroup.from

Defined in: packages/task/index.ts:121

id

Inherited from: TaskGroup.id

Defined in: packages/task/index.ts:116

isCancelled

Inherited from: TaskGroup.isCancelled

Defined in: packages/task/index.ts:124

isDone

Inherited from: TaskGroup.isDone

Defined in: packages/task/index.ts:126

isPaused

Inherited from: TaskGroup.isPaused

Defined in: packages/task/index.ts:125

isRunning

Inherited from: TaskGroup.isRunning

Defined in: packages/task/index.ts:127

path

Inherited from: TaskGroup.path

Defined in: packages/task/index.ts:117

progress

Inherited from: TaskGroup.progress

Defined in: packages/task/index.ts:118

state

Inherited from: TaskGroup.state

Defined in: packages/task/index.ts:122

to

Inherited from: TaskGroup.to

Defined in: packages/task/index.ts:120

total

Inherited from: TaskGroup.total

Defined in: packages/task/index.ts:119

🔧 Methods

all

ts
all(tasks: Iterable<T>, __namedParameters: Object= ...): Promise<(T extends Task<R> ? R : never)[]>

Parameters

  • tasks: Iterable<T>
  • __namedParameters: Object

Return Type

  • Promise<(T extends Task<R> ? R : never)[]>

Inherited from: TaskGroup.all

Defined in: packages/task/index.ts:311

cancel

ts
cancel(timeout: number): Promise<void>

Parameters

  • timeout: number

Return Type

  • Promise<void>

Inherited from: TaskGroup.cancel

Defined in: packages/task/index.ts:145

cancelTask

ts
cancelTask(): Promise<void>

Return Type

  • Promise<void>

Inherited from: TaskGroup.cancelTask

Defined in: packages/task/index.ts:299

concat

ts
concat(task: TaskRoutine<T>): Promise<T>

Parameters

  • task: TaskRoutine<T>

Return Type

  • Promise<T>

Defined in: packages/task/index.ts:355

get

ts
get(): void | T

Return Type

  • void | T

Inherited from: TaskGroup.get

Defined in: packages/task/index.ts:108

map

ts
map(transform: Transform<TaskRoutine<T>, N>): Task<N extends Promise<R> ? R : N>

Parameters

  • transform: Transform<TaskRoutine<T>, N>

Return Type

  • Task<N extends Promise<R> ? R : N>

Inherited from: TaskGroup.map

Defined in: packages/task/index.ts:212

onChildUpdate

ts
onChildUpdate(chunkSize: number): void

Parameters

  • chunkSize: number

Return Type

  • void

Inherited from: TaskGroup.onChildUpdate

Defined in: packages/task/index.ts:287

pause

ts
pause(): Promise<void>

Return Type

  • Promise<void>

Inherited from: TaskGroup.pause

Defined in: packages/task/index.ts:129

pauseTask

ts
pauseTask(): Promise<void>

Return Type

  • Promise<void>

Inherited from: TaskGroup.pauseTask

Defined in: packages/task/index.ts:303

resume

ts
resume(): Promise<void>

Return Type

  • Promise<void>

Inherited from: TaskGroup.resume

Defined in: packages/task/index.ts:137

resumeTask

ts
resumeTask(): Promise<void>

Return Type

  • Promise<void>

Inherited from: TaskGroup.resumeTask

Defined in: packages/task/index.ts:307

runTask

ts
runTask(): Promise<T>

Return Type

  • Promise<T>

Defined in: packages/task/index.ts:378

setName

ts
setName(name: string, param: object): TaskRoutine<T>

Parameters

  • name: string
  • param: object

Return Type

  • TaskRoutine<T>

Inherited from: TaskGroup.setName

Defined in: packages/task/index.ts:102

start

ts
start(context: TaskContext, parent: Task<any>): void

Parameters

  • context: TaskContext
  • parent: Task<any>

Return Type

  • void

Inherited from: TaskGroup.start

Defined in: packages/task/index.ts:164

startAndWait

ts
startAndWait(context: TaskContext, parent: Task<any>): Promise<T>

Parameters

  • context: TaskContext
  • parent: Task<any>

Return Type

  • Promise<T>

Inherited from: TaskGroup.startAndWait

Defined in: packages/task/index.ts:195

update

ts
update(chunkSize: number): void

Parameters

  • chunkSize: number

Return Type

  • void

Inherited from: TaskGroup.update

Defined in: packages/task/index.ts:200

wait

ts
wait(): Promise<T>

Return Type

  • Promise<T>

Inherited from: TaskGroup.wait

Defined in: packages/task/index.ts:160

yield

ts
yield(task: Task<T>): Promise<T>

Yield a new child task to this routine

Parameters

  • task: Task<T>

Return Type

  • Promise<T>

Defined in: packages/task/index.ts:370

Released under the MIT License.