LossyQueue
Defined in: packages/data/src/queue/lossy-queue.ts:26
A FIFO queue that never throws or waits on an over-capacity enqueue,
evicting the front (oldest) item — or skipping the incoming one — instead.
capacity has no default: an unbounded lossy queue can never fill up, so
overflowPolicy would never apply, defeating the entire point of this type.
A caller wanting an unbounded FIFO should use Queue.
Type Parameters
Section titled “Type Parameters”T extends DefinedValue
The type of elements in the queue.
Implements
Section titled “Implements”ILossyQueue<T>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new LossyQueue<
T>(iterable,options):LossyQueue<T>
Defined in: packages/data/src/queue/lossy-queue.ts:31
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T, any, any> | undefined
options
Section titled “options”Returns
Section titled “Returns”LossyQueue<T>
Properties
Section titled “Properties”capacity
Section titled “capacity”
readonlycapacity:number
Defined in: packages/data/src/queue/lossy-queue.ts:28
The maximum number of elements the collection can hold.
Note: Infinity is not a legal value here — an unbounded type omits this
mixin.
Implementation of
Section titled “Implementation of”overflowPolicy
Section titled “overflowPolicy”
readonlyoverflowPolicy:OverflowPolicy
Defined in: packages/data/src/queue/lossy-queue.ts:29
Policy applied when the collection reaches its capacity.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”[iterator]()
Section titled “[iterator]()”[iterator]():
Iterator<T>
Defined in: packages/data/src/queue/lossy-queue.ts:48
Returns
Section titled “Returns”Iterator<T>
Implementation of
Section titled “Implementation of”clear()
Section titled “clear()”clear():
void
Defined in: packages/data/src/queue/lossy-queue.ts:52
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/lossy-queue.ts:56
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/lossy-queue.ts:100
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): readonlyT[]
Defined in: packages/data/src/queue/lossy-queue.ts:60
Same as IQueue.enqueue, but never throws — returns the items dropped to
make room (empty if nothing was dropped).
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”readonly T[]
IQueue.enqueue
Implementation of
Section titled “Implementation of”enqueueAll()
Section titled “enqueueAll()”enqueueAll(
items): readonlyT[]
Defined in: packages/data/src/queue/lossy-queue.ts:76
Same as IQueue.enqueueAll, but never throws — returns the items dropped
to make room (empty if nothing was dropped).
Parameters
Section titled “Parameters”readonly T[]
Returns
Section titled “Returns”readonly T[]
IQueue.enqueueAll
Implementation of
Section titled “Implementation of”front()
Section titled “front()”front():
T|undefined
Defined in: packages/data/src/queue/lossy-queue.ts:104
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.