PriorityQueue
A queue that you can enqueue
into (with priority) and flush
.
new PriorityQueue(name [, callbacks])
Creates a priority queue instance.
A PriorityQueue works like a CompletionQueue. Except:
- PriorityQueues run tasks in order of their
meta.priority
. - PriorityQueues only allows one instance of a given
fn
to be enqueued at one time.
Parameters
- name
{String}
:The name of the queue used for logging.
- callbacks
{Object}
:Optional. An object containing callbacks
onFirstTask
and/oronComplete
.onFirstTask
- is called when the first task is added to an empty queueonComplete
- is called when the queue is empty.
Returns
{Object}
:
An instance of PriorityQueue
.