Skip to content

Class BaseTask

🏭 Constructors

constructor

ts
new BaseTask(): BaseTask<T>

Return Type

  • BaseTask<T>

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

🏷️ Properties

_from

ts
_from: undefined | string

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

_id

ts
_id: number = 0

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

_path

ts
_path: string = ''

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

_progress

ts
_progress: number = 0

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

_promise

ts
_promise: Promise<T>

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

_state

ts
_state: TaskState = TaskState.Idle

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

_to

ts
_to: undefined | string

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

_total

ts
_total: number = -1

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

context

ts
context: TaskContext = {}

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

name

ts
name: string = ''

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

param

ts
param: object = {}

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

parent

ts
parent: undefined | Task<any>

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

reject

ts
reject: Function

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

resolve

ts
resolve: Function

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

resultOrError

ts
resultOrError: any

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

🔑 Accessors

from

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

id

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

isCancelled

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

isDone

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

isPaused

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

isRunning

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

path

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

progress

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

state

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

to

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

total

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

🔧 Methods

cancel

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

Parameters

  • timeout: number

Return Type

  • Promise<void>

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

cancelTask

ts
cancelTask(): Promise<void>

Return Type

  • Promise<void>

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

get

ts
get(): void | T

Return Type

  • void | T

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

map

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

Parameters

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

Return Type

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

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

onChildUpdate

ts
onChildUpdate(chunkSize: number): void

Parameters

  • chunkSize: number

Return Type

  • void

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

pause

ts
pause(): Promise<void>

Return Type

  • Promise<void>

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

pauseTask

ts
pauseTask(): Promise<void>

Return Type

  • Promise<void>

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

resume

ts
resume(): Promise<void>

Return Type

  • Promise<void>

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

resumeTask

ts
resumeTask(): Promise<void>

Return Type

  • Promise<void>

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

runTask

ts
runTask(): Promise<T>

Return Type

  • Promise<T>

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

setName

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

Parameters

  • name: string
  • param: object

Return Type

  • BaseTask<T>

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

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>

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

update

ts
update(chunkSize: number): void

Parameters

  • chunkSize: number

Return Type

  • void

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

wait

ts
wait(): Promise<T>

Return Type

  • Promise<T>

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

Released under the MIT License.