@ac-essentials/misc-util
    Preparing search index...

    Class Stack<T>

    The LIFO stack implementation.

    Type Parameters

    • T

      The type of elements in the stack.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    capacity: number = Infinity

    The maximum number of elements the collection can hold. If the collection is unbounded, this will be Infinity.

    data: NativeArray<T>

    Methods

    • Adds one or more items to the top of the stack.

      The items are added in the order they are provided. The last item in the argument list will be the first one to be popped.

      Parameters

      • ...items: T[]

        The items to add to the stack.

      Returns void

      If the operation would exceed the stack's capacity.

    • Returns the item at the top of the stack without removing it.

      Returns undefined | T

      The item at the top of the stack, or undefined if the stack is empty.

    • Same as push, but waits for capacity if the operation would exceed it.

      Parameters

      • items: Iterable<T>
      • Optionalsignal: null | AbortSignal

        Optional abort signal to cancel the operation.

      Returns Promise<void>

      IStack.push