BlockingDeque
Defined in: packages/data/src/deque/blocking-deque.ts:23
A double-ended queue that holds at most capacity items, and whose
waitUnshift/waitPush suspend until room frees up instead of throwing.
unshift and push still throw — this type adds a way to wait, it does not
change the way to fail.
Type Parameters
Section titled “Type Parameters”T extends DefinedValue
The type of elements in the deque.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BlockingDeque<
T>(iterable,options):BlockingDeque<T>
Defined in: packages/data/src/deque/blocking-deque.ts:30
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T, any, any> | undefined
options
Section titled “options”Returns
Section titled “Returns”BlockingDeque<T>
Properties
Section titled “Properties”capacity
Section titled “capacity”
readonlycapacity:number
Defined in: packages/data/src/deque/blocking-deque.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”Methods
Section titled “Methods”[iterator]()
Section titled “[iterator]()”[iterator]():
Iterator<T>
Defined in: packages/data/src/deque/blocking-deque.ts:44
Returns
Section titled “Returns”Iterator<T>
Implementation of
Section titled “Implementation of”back()
Section titled “back()”back():
T|undefined
Defined in: packages/data/src/deque/blocking-deque.ts:156
Returns the item at the back of the deque without removing it.
Returns
Section titled “Returns”T | undefined
The item at the back of the deque, or undefined if the deque is
empty.
Implementation of
Section titled “Implementation of”clear()
Section titled “clear()”clear():
void
Defined in: packages/data/src/deque/blocking-deque.ts:48
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/deque/blocking-deque.ts:55
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”front()
Section titled “front()”front():
T|undefined
Defined in: packages/data/src/deque/blocking-deque.ts:152
Returns the item at the front of the deque without removing it.
Returns
Section titled “Returns”T | undefined
The item at the front of the deque, or undefined if the deque is
empty.
Implementation of
Section titled “Implementation of”pop():
T|undefined
Defined in: packages/data/src/deque/blocking-deque.ts:142
Removes and returns the item at the back of the deque.
Returns
Section titled “Returns”T | undefined
The item at the back of the deque, or undefined if the deque is
empty.
Implementation of
Section titled “Implementation of”push()
Section titled “push()”push(
item):void
Defined in: packages/data/src/deque/blocking-deque.ts:96
Adds an item to the back of the deque.
Parameters
Section titled “Parameters”T
The item to add to the back of the deque.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”pushAll()
Section titled “pushAll()”pushAll(
items):void
Defined in: packages/data/src/deque/blocking-deque.ts:101
Adds every item to the back of the deque.
The items keep their relative order, so the last element of the array
becomes the new back — Array.prototype.push semantics.
Parameters
Section titled “Parameters”readonly T[]
The items to add to the back of the deque.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”shift()
Section titled “shift()”shift():
T|undefined
Defined in: packages/data/src/deque/blocking-deque.ts:132
Removes and returns the item at the front of the deque.
Returns
Section titled “Returns”T | undefined
The item at the front of the deque, or undefined if the deque is
empty.
Implementation of
Section titled “Implementation of”unshift()
Section titled “unshift()”unshift(
item):void
Defined in: packages/data/src/deque/blocking-deque.ts:59
Adds an item to the front of the deque.
Parameters
Section titled “Parameters”T
The item to add to the front of the deque.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”unshiftAll()
Section titled “unshiftAll()”unshiftAll(
items):void
Defined in: packages/data/src/deque/blocking-deque.ts:65
Adds every item to the front of the deque.
The items keep their relative order, so the first element of the array
becomes the new front — Array.prototype.unshift semantics.
Parameters
Section titled “Parameters”readonly T[]
The items to add to the front of the deque.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”waitPush()
Section titled “waitPush()”waitPush(
item,signal?):Promise<void>
Defined in: packages/data/src/deque/blocking-deque.ts:111
Same as push, but waits for capacity if the operation would exceed it.
Parameters
Section titled “Parameters”T
signal?
Section titled “signal?”AbortSignal | null
Optional abort signal to cancel the operation.
Returns
Section titled “Returns”Promise<void>
IDeque.push
Implementation of
Section titled “Implementation of”waitPushAll()
Section titled “waitPushAll()”waitPushAll(
items,signal?):Promise<void>
Defined in: packages/data/src/deque/blocking-deque.ts:117
Same as pushAll, but waits for capacity if the operation would exceed it.
The whole batch lands at once, never interleaved with another waiter’s.
Parameters
Section titled “Parameters”Iterable<T>
signal?
Section titled “signal?”AbortSignal | null
Optional abort signal to cancel the operation.
Returns
Section titled “Returns”Promise<void>
IDeque.pushAll
Implementation of
Section titled “Implementation of”waitUnshift()
Section titled “waitUnshift()”waitUnshift(
item,signal?):Promise<void>
Defined in: packages/data/src/deque/blocking-deque.ts:75
Same as unshift, but waits for capacity if the operation would exceed it.
Parameters
Section titled “Parameters”T
signal?
Section titled “signal?”AbortSignal | null
Optional abort signal to cancel the operation.
Returns
Section titled “Returns”Promise<void>
IDeque.unshift
Implementation of
Section titled “Implementation of”waitUnshiftAll()
Section titled “waitUnshiftAll()”waitUnshiftAll(
items,signal?):Promise<void>
Defined in: packages/data/src/deque/blocking-deque.ts:81
Same as unshiftAll, but waits for capacity if the operation would exceed
it. The whole batch lands at once, never interleaved with another
waiter’s.
Parameters
Section titled “Parameters”Iterable<T>
signal?
Section titled “signal?”AbortSignal | null
Optional abort signal to cancel the operation.
Returns
Section titled “Returns”Promise<void>
IDeque.unshiftAll