new Queue( [tasks] [, opts])
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
tasks |
array |
<optional> |
[] | Optional. Tasks to put in the queue. |
opts |
object |
<optional> |
{} | Optional. Options. |
Members
-
length :number
-
Get length of the queue.
Type:
- number
Methods
-
abort()
-
Abort and clear all tasks.
-
dequeue()
-
Dequeue a task.
Returns:
- Type
- function
-
enqueue(task)
-
Enqueue a task.
Parameters:
Name Type Description task
function -
isAborted()
-
Is aborted.
Returns:
- Type
- boolean
-
isEmpty()
-
Is empty.
Returns:
- Type
- boolean
-
isPaused()
-
Is paused.
Returns:
- Type
- boolean
-
isRunning()
-
Is running.
Returns:
- Type
- boolean
-
pause()
-
Pause.
-
run()
-
Run.
Returns:
Resolves with the last task's result when all tasks are finished.
- Type
- Promise