The type of elements in the queue.
Readonly
capacityThe maximum number of elements the collection can hold.
If the collection is unbounded, this will be Infinity
.
Protected
Readonly
dataRemoves all elements from the collection.
Returns the number of elements in the collection.
Removes and returns the item at the front of the queue.
The item at the front of the queue, or undefined
if the queue is empty.
Adds one or more items to the rear of the queue.
The items are added in the order they are provided. The last item in the argument list will be the last one to be dequeued.
The items to add to the queue.
Returns the item at the front of the queue without removing it.
The item at the front of the queue, or undefined
if the queue is empty.
Replaces the first occurence of the item matching the given predicate in the collection with a new item.
true
if the item was found and replaced, false
otherwise.
Same as enqueue
, but waits for capacity if the operation would exceed it.
Optional
signal: null | AbortSignalOptional abort signal to cancel the operation.
A FIFO queue implementation.