collect-your-stuff
    Preparing search index...

    Class TaskStack

    Store a collection of tasks (Stackables) which can only be inserted and removed from the top: pop() takes the task from the top and RUNS it. For a plain last-in-first-out collection of items use Stack.

    Index
    • Instantiate the state with the starter stacked list.

      Parameters

      • stackedList: IsArrayable<any> = null

        The list of stackables to start in this stack.

      • listClass: any = LinkedList

        The type of list to create when no stacked list is given.

      • stackableClass: typeof Stackable = Stackable

        The class used to wrap stacked items.

      Returns TaskStack

    stackedList: IsArrayable<any>

    The list which stores the stackables, the first is the top of the stack.

    • Push a stackable task to the top of the stack.

      Parameters

      • stackable: any

        Add a new stackable to the top of the stack

      Returns void

    • Convert an array to a TaskStack.

      Parameters

      • values: any[] = []

        An array of values which will be converted to stackables in this queue

      • stackableClass: typeof Stackable = Stackable

        The class to use for each stackable

      • listClass: any = LinkedList

        The class to use to manage the stackables

      Returns TaskStack