Constructor
new StateManager(appInstance, parentStateopt)
Constructor
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
appInstance | App | Instance of app | ||
parentState | State | <optional> | null | Parent state for sub-state managers |
- Source
Methods
add(…stateClasses) → {boolean}
Add state class
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
stateClasses | DefaultBaseState | <repeatable> | State class to be added. |
- Source
Throws:
- Throws an error when adding state is not possible
- Type
- Error
Returns:
- Returns wheter or not adding was successful
- Type:
- boolean
create(stateId, routeParams) → {State|null}
Create an instance of given state id
Parameters:
Name | Type | Description |
---|---|---|
stateId | string | The state id to be instantiated |
routeParams | RouteParams | Current RouteParams |
- Source
Returns:
- State instance or null
- Type:
- State |
null
exists(stateId) → {boolean}
Checks if given stateId already exists.
Parameters:
Name | Type | Description |
---|---|---|
stateId | string |
- Source
Returns:
- Type:
- boolean
(async) switchTo(newState) → {Promise.<boolean>}
Switch to given state
Parameters:
Name | Type | Description |
---|---|---|
newState | DefaultBaseState | Instance of state to switch to |
- Source
Throws:
- Throws an error if given state cannot be entered, current state cannot be exited, or if enter()/exit() functions throw an error.
- Type
- Error
Returns:
- Type:
- Promise.<boolean>