Class: ProducerConsumerQueue

ProducerConsumerQueue(maxSizeopt, eqCompareropt)

new ProducerConsumerQueue(maxSizeopt, eqCompareropt)

Creates a new, empty ProducerConsumerQueue..
Parameters:
Name Type Attributes Description
maxSize number <optional>
Optional. Defaults to Number.MAX_SAFE_INTEGER. Use this parameter to limit the maximum amount of elements this Queue can hold. When the limit is reached and items are being further enqueued, the ProducerConsumerQueue will defer further calls and only resolve them, once space is available and the item has been enqueued. Likewise, an item is dequeued immediately if the queue is non-empty. Otherwise, the call is deferred and resolved once an item becomes available. Adjusting the capacity of this queue will only affect items in it, but not deferred calls to enqueue().
eqComparer EqualityComparer.<T> <optional>
Optional. Defaults To EqualityComparer..default.
Author:
Source:

Methods

dequeue() → {Promise.<T>}

Source:
Returns:
The promise is resolved once an item is available.
Type
Promise.<T>

enqueue(item) → {Promise.<this>}

Parameters:
Name Type Description
item T The item to be enqueued.
Source:
Returns:
The promise is resolved once the item got enqueued.
Type
Promise.<this>