Class: History

Syntree.History

Manages and stores Actions

Constructor

new History()

Source:

Members

(static) actions

Actions is stored as a queue with the most recent action at the end (index length-1). Note that it is returned as an array with the most recent action at the front (index 0).
Source:
See:
  • Syntree.History.getAll()

(static) silent

While this is set to true, no Actions are added to the history. This is used so that we don't have to worry about creating new Actions while undoing old ones.
Source:

Methods

(static) addAction()

Add an action to the history.
Source:
See:

(static) getAll() → {Array.<Syntree.Action>}

Get all Actions, reversed so that the most recent is at the front.
Source:
See:
Returns:
- all actions in the history.
Type
Array.<Syntree.Action>

(static) getAllByType() → {Array.<Syntree.Action>}

Get all Actions, reversed so that the most recent is at the front. Filter by given type.
Parameters:
Type Description
string type of action to filter by, e.g. 'select'
Source:
See:
Returns:
- all actions matching the given type
Type
Array.<Syntree.Action>

(static) getLast() → {Syntree.Action}

Get the most recent Action.
Source:
See:
Returns:
- the most recent action.
Type
Syntree.Action

(static) getLastOfType() → {Syntree.Action}

Get the most recent Action of given type.
Parameters:
Type Description
string type of action to filter by, e.g. 'select'
Source:
See:
Returns:
- most recent action of given type
Type
Syntree.Action

(static) getNodeSelects() → {Array.<Syntree.Action>}

Get all Actions representing a Node selection. This is a convenience function, so that we don't have to filter for selected element type inline.
Source:
See:
Returns:
- all Node select actions, most recent at index 0
Type
Array.<Syntree.Action>

(static) removeAction()

Remove the given Action from the history.
Parameters:
Type Description
Syntree.Action action to remove
Source:
See:

(static) undo()

Undo the most recent undoable Action. During this function, History is silenced so that it does not collect eroneously produced Actions.
Source:
See: