Adds an item at the end of a queue. If the queue was empty and there are any pending requests from
take()
, the first one receives the item. If the queue has been closed, nothing happens.
The item to add.
Signals that the queue ends permanently after its current position. After calling close()
,
take()
will still consume any items that already exist in the queue, but once it is empty,
take()
returns an error. No more items can be added.
Tests whether the queue is empty.
True if the queue is empty.
Returns the current number of items in the queue.
The length of the queue.
Attempts to consume an item from the queue in FIFO order, waiting until there is one, unless the queue is closed.
A Promise that is resolved with the first item in the queue once it is available, removing the
item. If the queue is empty and has been closed with close()
, the Promise is rejected instad.
Generated using TypeDoc
A Promise-based blocking queue.