CRStateMachine
This class implements basic state management functions.
Contstructor
- CRStateMachine()
Properties
- state
- String, readOnly
- The current state
- subState
- String, readOnly
- The current subState
- prevState
- String, readOnly
- The previous state
Methods
- addEventListener(type, listener)
- Adds an event listener to an event type
Parameters
- type
- String, required
- The event type
- listener
- Function(event), required
- A function which is called when the event is delivered
- removeEventListener(type, listener)
- Removes an event listener
Parameters
- type
- String, required
- The event type
- listener
- Function(event), required
- The event listener function
Events
- stateChanged
- Delivers the name of the new state.
- subStateChanged
- Delivers the name of the new subState.