Constructor
new State(app, routeParamsopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
app | App | App instance | |
routeParams | RouteParams | <optional> | Current route params |
- Source
Example
Create a state called MyState with is executed when the url 'my-state' is called. When executed,
it prints 'Hello from MyState' to the console.
class MyState extends State
{
asnyc enter()
{
console.log( "Hello from MyState" );
}
}
Members
ID :string|null
ID of state. Should be an unique identifier. If not set it will be auto-generated.
Type:
- string |
null
- Source
ROUTE :string|array
Route(s) which trigger this state
Type:
- string |
array
- Source
Methods
canEnter() → {boolean}
Called before entering state.
- Source
Returns:
- Type:
- boolean
canExit() → {boolean}
Called before exiting state.
- Source
Returns:
- Type:
- boolean
(async) enter() → {Promise.<void>}
Called when entering scene and after canEnter() call returned true.
- Source
Returns:
- Type:
- Promise.<void>
(async) exit() → {Promise.<void>}
Called when exiting scene and after canExit() call return true.
- Source
Returns:
- Type:
- Promise.<void>
getId() → {string}
Return current ID
- Source
Returns:
- Type:
- string
getRedirectUrl() → {string|null}
Called when canEnter() function returns false.
- Source
Returns:
- Return redirect route.
- Type:
- string |
null