Options
All
  • Public
  • Public/Protected
  • All
Menu

Task is used to run in the pipeline for some effect

Hierarchy

  • Task

Index

Constructors

constructor

Properties

id

id: number = Task._taskId++

The id of task

input

input: any = null

The input of task

isFinish

isFinish: boolean = true

Whether or not this task is completed

onComplete

onComplete: TaskCompleteCallback | null = null

The callback when task is completed

onError

onError: TaskErrorCallback | null = null

The callback when something goes wrong

onProgress

onProgress: TaskProgressCallback | null = null

The callback of progression

options

options: Record<string, any> | null = null

Custom options

output

output: any = null

The output of task

progress

progress: any = null

The progression of task

source

source: any = null

The source of task

Static MAX_DEAD_NUM

MAX_DEAD_NUM: number = 500

Static Private _deadPool

_deadPool: Task[] = []

Static Private _taskId

_taskId: number = 0

Methods

dispatch

  • dispatch(event: string, param1?: any, param2?: any, param3?: any, param4?: any): void
  • Dispatch event

    example

    var task = Task.create(); Task.onComplete = (msg) => console.log(msg); Task.dispatch('complete', 'hello world');

    Parameters

    • event: string

      The event name

    • Optional param1: any

      Parameter 1

    • Optional param2: any

      Parameter 2

    • Optional param3: any

      Parameter 3

    • Optional param4: any

      Parameter 4

    Returns void

recycle

  • recycle(): void

set

  • Set paramters of this task

    example

    var task = new Task(); task.set({input: ['test'], onComplete: (err, result) => console.log(err), onProgress: (finish, total) => console.log(finish / total)});

    Parameters

    • Default value options: ITaskOption = Object.create(null)

      Some optional paramters

    Returns void

Static create

Generated using TypeDoc