Class: Stack

rune.util.Stack()

The Stack class represents a list of executable objects.

Constructor

new Stack()

Creates a new instance of the Stack class.
Source:

Members

(readonly) duration :number

The time (specified in milliseconds) it took to execute the contents of the entire list during the previous execution.
Type:
  • number
Source:

(readonly) length :number

The length of the stack, ie how many function calls are queued in the stack.
Type:
  • number
Source:

Methods

add(fn, scopeopt, argsopt) → {undefined}

Adds a function to the stack unless the same function, scope and argument list are already registered. Omitted, null and empty argument lists are equivalent. Non-empty argument lists are compared by reference.
Parameters:
Name Type Attributes Default Description
fn function Function to add.
scope Object <optional>
null The scope of the function call.
args Array <optional>
null Function argument.
Source:
Throws:
Argument must be of valid function type.
Type
TypeError
Returns:
Type
undefined

clear(disposeopt) → {undefined}

Empty the entire stack.
Parameters:
Name Type Attributes Description
dispose boolean <optional>
Whether or not the stack should empty allocated memory. Note that this process renders the object unusable.
Source:
Returns:
Type
undefined

dispose() → {undefined}

Process that frees the memory allocated by the current stack. Note that this process renders the object unusable.
Source:
Returns:
Type
undefined

execute(…args) → {undefined}

Executes all objects in the current stack. Callbacks removed before their turn are skipped. Callbacks added during execution wait until the next call. Clearing or disposing the stack stops execution of its remaining callbacks.
Parameters:
Name Type Attributes Description
args * <repeatable>
Functional arguments.
Source:
Returns:
Type
undefined

remove(fn, scopeopt) → {undefined}

Removes a function from the stack.
Parameters:
Name Type Attributes Default Description
fn function Function to remove.
scope Object <optional>
null The scope in which the function will be executed.
Source:
Returns:
Type
undefined