Constructs a new priority queue.
Default timeout used for remove() call when no timeout was specified. Defaults to Number.POSITIVE_INFINITY.
Get a copy of the internal data buffer.
Note that the elements themselves are not copied, so if the contents are not native types, do not modify them.
Get the number of elements in the queue.
Get the number of pending promises if no elements are in the queue.
Add data to the queue.
This will throw if the queue is full.
lower values will have higher priority
Cancels all pending remove promises.
Optional
_err: ErrorClears the queue and returns the internal array.
Get element from queue.
If no element is in the queue, then the promise will not resolve, until there is.
Optional
timeout: numberTimeout as unsigned 32-bit integer or Number.POSITIVE_INFINITY. If undefined use the default value passed to the constructor.
Static
compareCompare function for sorting priorities.
A queue implementation where the reader promises block until new data is available.