# Class AsyncQueue

异步队列处理

### Example

    var queue: AsyncQueue = new AsyncQueue();
    queue.push((next: NextFunction, params: any, args: any) => {
       oops.res.load("language/font/" + oops.language.current, next);
    });
    queue.push((next: NextFunction, params: any, args: any) => {
       oops.res.loadDir("common", next);
    });
    queue.complete =  () => {
       console.log("处理完成");
    };
    queue.play();

#### Hierarchy

- AsyncQueue

- Defined in assets/libs/collection/AsyncQueue.ts:39

#####
Index

### Constructors

constructor

### Properties

_enable
_isProcessingTaskUUID
_queues
_runningAsyncTask
complete
_$uuid_count

### Accessors

enable
isProcessing
isStop
queues
runningParams
size

### Methods

clear
next
play
push
pushMulti
remove
step
yieldTime
excuteTimes

## Constructors

### constructor

- new AsyncQueue(): AsyncQueue

- #### Returns AsyncQueue

## Properties

### `Private` _enable

_enable: boolean = true

- Defined in assets/libs/collection/AsyncQueue.ts:55

### `Private` _isProcessingTaskUUID

_isProcessingTaskUUID: number = 0

- Defined in assets/libs/collection/AsyncQueue.ts:54

### `Private` _queues

_queues: AsyncTask[] = []

- Defined in assets/libs/collection/AsyncQueue.ts:46

### `Private` _runningAsyncTask

_runningAsyncTask: null | AsyncTask = null

- Defined in assets/libs/collection/AsyncQueue.ts:44

### complete

complete: null | Function = null

任务队列完成回调

- Defined in assets/libs/collection/AsyncQueue.ts:75

### `Static` `Private` _$uuid_count

_$uuid_count: number = 1

- Defined in assets/libs/collection/AsyncQueue.ts:41

## Accessors

### enable

- get enable(): boolean

- 是否开启可用

  #### Returns boolean

  - Defined in assets/libs/collection/AsyncQueue.ts:58
- set enable(val: boolean): void

- 是否开启可用

  #### Parameters

  - ##### val: boolean

  #### Returns void

  - Defined in assets/libs/collection/AsyncQueue.ts:62

### isProcessing

- get isProcessing(): boolean

- 是否有正在处理的任务

  #### Returns boolean

  - Defined in assets/libs/collection/AsyncQueue.ts:131

### isStop

- get isStop(): boolean

- 队列是否已停止

  #### Returns boolean

  - Defined in assets/libs/collection/AsyncQueue.ts:136

### queues

- get queues(): AsyncTask[]

- 任务队列

  #### Returns AsyncTask[]

  - Defined in assets/libs/collection/AsyncQueue.ts:49

### runningParams

- get runningParams(): any

- 正在执行的任务参数

  #### Returns any

  - Defined in assets/libs/collection/AsyncQueue.ts:147

### size

- get size(): number

- 队列长度

  #### Returns number

  - Defined in assets/libs/collection/AsyncQueue.ts:126

## Methods

### clear

- clear(): void

- 清空队列

  #### Returns void

  - Defined in assets/libs/collection/AsyncQueue.ts:155

### `Protected` next

- next(taskUUID: number, args?: any): void

- #### Parameters

  - ##### taskUUID: number

  - ##### args: any = null

  #### Returns void

  - Defined in assets/libs/collection/AsyncQueue.ts:238

### play

- play(args?: any): void

- 开始运行队列

  #### Parameters

  - ##### args: any = null

    参数

  #### Returns void

  - Defined in assets/libs/collection/AsyncQueue.ts:172

### push

- push(callback: AsyncCallback, params?: any): number

- 添加一个异步任务到队列中

  #### Parameters

  - ##### callback: AsyncCallback

    回调

  - ##### params: any = null

    参数

  #### Returns number

  - Defined in assets/libs/collection/AsyncQueue.ts:82

### pushMulti

- pushMulti(params: any, ...callbacks: AsyncCallback []): number

- 添加多个任务，多个任务函数会同时执行

  ### Returns

  #### Parameters

  - ##### params: any

    参数据

  - ##### `Rest` ...callbacks: AsyncCallback []

    回调

  #### Returns number

  - Defined in assets/libs/collection/AsyncQueue.ts:98

### remove

- remove(uuid: number): void

- 移除一个还未执行的异步任务

  #### Parameters

  - ##### uuid: number

    任务唯一编号

  #### Returns void

  - Defined in assets/libs/collection/AsyncQueue.ts:112

### step

- step(): void

- 跳过当前正在执行的任务

  #### Returns void

  - Defined in assets/libs/collection/AsyncQueue.ts:162

### yieldTime

- yieldTime(time: number, callback?: null | Function): void

- 往队列中push一个延时任务

  #### Parameters

  - ##### time: number

    毫秒时间

  - ##### callback: null | Function = null

    （可选参数）时间到了之后回调

  #### Returns void

  - Defined in assets/libs/collection/AsyncQueue.ts:225

### `Static` excuteTimes

- excuteTimes(count: number, next?: null | Function): Function

- 返回一个执行函数，执行函数调用count次后，next将触发

  ### Returns

  返回一个匿名函数

  #### Parameters

  - ##### count: number

  - ##### next: null | Function = null

  #### Returns Function

  - Defined in assets/libs/collection/AsyncQueue.ts:257

Generated using TypeDoc