Constructor
# new Router(app, routes)
Create a dot.
Parameters:
Name | Type | Description |
---|---|---|
app |
object
|
The app object. |
routes |
object
|
The routes object. |
Classes
Methods
# getRouteByName(routeName) → {object}
Get a route by its name.
Parameters:
Name | Type | Description |
---|---|---|
routeName |
string
|
Name of route to find. |
The route or null.
object
# handlePopState()
Handle pop state events.
Pop state events are fired from the browser, ie. when user goes back and forth in the browser hostory.
# loadRoute(route, pushFlag)
Load a route.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
route |
object
|
The route to load. | |
pushFlag |
boolean
|
true | If true, new state will be pushed to window.history |
# loadRouteByName(routeName, pushFlag)
Load a route by its name.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
routeName |
string
|
Name of route to load. | |
pushFlag |
boolean
|
true | If true, new state will be pushed to window.history |
# start(routeName)
Start routing
Parameters:
Name | Type | Description |
---|---|---|
routeName |
string
|
Name of route to start with. |