Skip to content

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.

T extends DefinedValue

The type of elements in the queue.

new Queue<T>(iterable?, options?): Queue<T>

Defined in: packages/data/src/queue/queue.ts:23

Iterable<T, any, any>

QueueOptions<T>

Queue<T>

[iterator](): Iterator<T>

Defined in: packages/data/src/queue/queue.ts:33

Iterator<T>

IQueue.[iterator]


clear(): void

Defined in: packages/data/src/queue/queue.ts:37

Removes all elements from the collection.

void

IQueue.clear


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.

number

IQueue.count


dequeue(): T | undefined

Defined in: packages/data/src/queue/queue.ts:53

Removes and returns the item at the front of the queue.

T | undefined

The item at the front of the queue, or undefined if the queue is empty.

IQueue.dequeue


enqueue(item): void

Defined in: packages/data/src/queue/queue.ts:45

Adds an item to the rear of the queue.

T

The item to add to the queue.

void

IQueue.enqueue


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.

readonly T[]

The items to add to the queue.

void

IQueue.enqueueAll


front(): T | undefined

Defined in: packages/data/src/queue/queue.ts:57

Returns the item at the front of the queue without removing it.

T | undefined

The item at the front of the queue, or undefined if the queue is empty.

IQueue.front