Class: StateTracker

StateTracker(reporter, settings)

StateTracker Tracks states and brings undo/redo functionality

Constructor

new StateTracker(reporter, settings)

Parameters:
Name Type Description
reporter Reporter
settings Object
Source:

Members

(protected) _cursor :number

Type:
  • number
Source:

(protected) _stateRegister :Array.<any>

Type:
  • Array.<any>
Source:

canRedo

Whether a redo is currently possible
Source:

canUndo

Whether an undo is currently possible
Source:

Methods

(async) addState(data)

Add a new state to the register
Parameters:
Name Type Description
data Object
Properties
Name Type Attributes Default Description
newState any
moveCursor false | true | 'silent' <optional>
true
Source:

onStateCursorMoved(selectedState)

Parameters:
Name Type Description
selectedState any
Source:

redo(steps) → {Promise.<Object>}

Go forward in the configuration timeline by increasing the cursor position
Parameters:
Name Type Default Description
steps number 1
Source:
Returns:
Type
Promise.<Object>

(async) setCursor(newPosition) → {Promise.<Object>}

Parameters:
Name Type Description
newPosition number
Source:
Returns:
Type
Promise.<Object>

undo(stepsopt) → {Promise.<Object>}

Go back to the previous configuration by decreasing the cursor position
Parameters:
Name Type Attributes Default Description
steps number <optional>
1
Source:
Returns:
Type
Promise.<Object>