BlockingStack
Defined in: packages/data/src/stack/blocking-stack.ts:23
A LIFO stack that holds at most capacity items, and whose waitPush
suspends until room frees up instead of throwing.
push still throws — 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 stack.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BlockingStack<
T>(iterable,options):BlockingStack<T>
Defined in: packages/data/src/stack/blocking-stack.ts:30
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T, any, any> | undefined
options
Section titled “options”Returns
Section titled “Returns”BlockingStack<T>
Properties
Section titled “Properties”capacity
Section titled “capacity”
readonlycapacity:number
Defined in: packages/data/src/stack/blocking-stack.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/stack/blocking-stack.ts:44
Returns
Section titled “Returns”Iterator<T>
Implementation of
Section titled “Implementation of”clear()
Section titled “clear()”clear():
void
Defined in: packages/data/src/stack/blocking-stack.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/stack/blocking-stack.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”pop():
T|undefined
Defined in: packages/data/src/stack/blocking-stack.ts:92
Removes and returns the item at the top of the stack.
Returns
Section titled “Returns”T | undefined
The item at the top of the stack, or undefined if the stack is
empty.
Implementation of
Section titled “Implementation of”push()
Section titled “push()”push(
item):void
Defined in: packages/data/src/stack/blocking-stack.ts:59
Adds an item to the top of the stack.
Parameters
Section titled “Parameters”T
The item to add to the stack.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”pushAll()
Section titled “pushAll()”pushAll(
items):void
Defined in: packages/data/src/stack/blocking-stack.ts:64
Adds every item to the top of the stack, in array order, so the last one is the first to be popped.
Parameters
Section titled “Parameters”readonly T[]
The items to add to the stack.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”top():
T|undefined
Defined in: packages/data/src/stack/blocking-stack.ts:102
Returns the item at the top of the stack without removing it.
Returns
Section titled “Returns”T | undefined
The item at the top of the stack, or undefined if the stack is
empty.
Implementation of
Section titled “Implementation of”waitPush()
Section titled “waitPush()”waitPush(
item,signal?):Promise<void>
Defined in: packages/data/src/stack/blocking-stack.ts:73
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>
IStack.push
Implementation of
Section titled “Implementation of”waitPushAll()
Section titled “waitPushAll()”waitPushAll(
items,signal?):Promise<void>
Defined in: packages/data/src/stack/blocking-stack.ts:78
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>
IStack.pushAll