Options
All
  • Public
  • Public/Protected
  • All
Menu

任务用于在管线中运行以达成某种效果

Hierarchy

  • Task

Index

Constructors

constructor

Properties

id

id: number = Task._taskId++

任务id

input

input: any = null

任务的输入

isFinish

isFinish: boolean = true

此任务是否已经完成

onComplete

onComplete: TaskCompleteCallback | null = null

完成回调

onError

onError: TaskErrorCallback | null = null

错误回调

onProgress

onProgress: TaskProgressCallback | null = null

进度回调

options

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

自定义参数

output

output: any = null

任务的输出

progress

progress: any = null

任务的进度

source

source: any = null

任务的源

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
  • 发布事件

    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

  • 设置任务的参数

    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