new WorkQueue(opts)
Parameters:
Name | Type | Description |
---|---|---|
opts |
Object | Options. |
- Source:
- mapspace/collections/workqueue.js
Methods
-
cancel(task)
-
Cancels a task calling the cancellation function.
Parameters:
Name Type Description task
Mapspace.WorkTask the task to cancel.
- Source:
- mapspace/collections/workqueue.js
-
finish(task)
-
Ends a given task calling its callback.
Parameters:
Name Type Description task
Mapspace.WorkTask the task to end.
- Source:
- mapspace/collections/workqueue.js
-
length()
-
Returns the number of taks in the queue.
- Source:
- mapspace/collections/workqueue.js
Returns:
The number of tasks.
- Type
- number
-
next()
-
Jumps queue to next task.
- Source:
- mapspace/collections/workqueue.js
-
pause()
-
Pauses the queue.
- Source:
- mapspace/collections/workqueue.js
-
push(fn, cb)
-
Add a task to the queue and run it if idle.
Parameters:
Name Type Description fn
function function to execute.
cb
function callback.
- Source:
- mapspace/collections/workqueue.js
Returns:
The cancellation function.
- Type
- function
-
resume()
-
Restarts queue.
- Source:
- mapspace/collections/workqueue.js
-
start(task)
-
Executes a given task.
Parameters:
Name Type Description task
Mapspace.WorkTask the task to execute.
- Source:
- mapspace/collections/workqueue.js