Queue
Defined in: packages/data/src/queue/queue.ts:20
An unbounded FIFO queue.
For a capacity, use BoundedQueue (throws when full), BlockingQueue
(waits) or LossyQueue (evicts) — one class per answer to “what happens when
it is full”, rather than one class with a flag.
Type Parameters
Section titled “Type Parameters”T extends DefinedValue
The type of elements in the queue.
Implements
Section titled “Implements”IQueue<T>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Queue<
T>(iterable?,options?):Queue<T>
Defined in: packages/data/src/queue/queue.ts:23
Parameters
Section titled “Parameters”iterable?
Section titled “iterable?”Iterable<T, any, any>
options?
Section titled “options?”QueueOptions<T>
Returns
Section titled “Returns”Queue<T>
Methods
Section titled “Methods”[iterator]()
Section titled “[iterator]()”[iterator]():
Iterator<T>
Defined in: packages/data/src/queue/queue.ts:33
Returns
Section titled “Returns”Iterator<T>
Implementation of
Section titled “Implementation of”clear()
Section titled “clear()”clear():
void
Defined in: packages/data/src/queue/queue.ts:37
Removes all elements from the collection.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”count()
Section titled “count()”count():
number
Defined in: packages/data/src/queue/queue.ts:41
The number of elements in the collection.
A method, not a getter: its async counterpart needs a round trip to the backing store, and a member must have the same shape in both.
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”dequeue()
Section titled “dequeue()”dequeue():
T|undefined
Defined in: packages/data/src/queue/queue.ts:53
Removes and returns the item at the front of the queue.
Returns
Section titled “Returns”T | undefined
The item at the front of the queue, or undefined if the queue is
empty.
Implementation of
Section titled “Implementation of”enqueue()
Section titled “enqueue()”enqueue(
item):void
Defined in: packages/data/src/queue/queue.ts:45
Adds an item to the rear of the queue.
Parameters
Section titled “Parameters”T
The item to add to the queue.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”enqueueAll()
Section titled “enqueueAll()”enqueueAll(
items):void
Defined in: packages/data/src/queue/queue.ts:49
Adds every item to the rear of the queue, in array order, so the last one is the last to be dequeued.
Parameters
Section titled “Parameters”readonly T[]
The items to add to the queue.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”front()
Section titled “front()”front():
T|undefined
Defined in: packages/data/src/queue/queue.ts:57
Returns the item at the front of the queue without removing it.
Returns
Section titled “Returns”T | undefined
The item at the front of the queue, or undefined if the queue is
empty.