Constructor
new States(appInstance)
Constructor
Parameters:
Name | Type | Description |
---|---|---|
appInstance | App | Instance of app |
- 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) → {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:
- Type:
- null
exists(stateId) → {boolean}
Checks if given stateId already exists.
Parameters:
Name | Type | Description |
---|---|---|
stateId | string |
- Source
Returns:
- Type:
- boolean
setStateNotFoundClass(notFoundClass)
Set the StateNotFound class
Parameters:
Name | Type | Description |
---|---|---|
notFoundClass | State | State class used in case when a state is not found |
- Source
Throws:
- Thrown when provided param is not of type State
- Type
- Error
(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 or if enter() function throws an error.
- Type
- Error
Returns:
- Type:
- Promise.<boolean>