Constructor
new Router(_routesopt)
- Source:
Example
Sample Router Object is to be implement in "AppViewManager" class (subclass of ViewManager)
initRoutes() {
let tmpRoutes = [
{ path: "/login", navigatorId: " LoginNavigator",parentId: "root" },
{ path: "/file", navigatorId: " FileNavigator",parentId: "root" },
{ path: "/logout", navigatorId: "ExitNavigator",parentId: "root" },
]
this.routes = new Router(tmpRoutes);
}
Here "path" is routeID, "navigatorId" is viewNavigatorId, "parentId" is DOM Element Id or ViewId or ContainerId.
By Default Main DOM Element have id="root"
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
_routes |
array |
<optional> |
[]
|
Path routes array |
Classes
Methods
addRoute(_path, _navigatorId, _parentId)
- Source:
Adds new Path Route
Parameters:
Name | Type | Description |
---|---|---|
_path |
string | Path Name |
_navigatorId |
string | Navigator ID |
_parentId |
string | Parent Object / Element ID |
findNavigator(_route) → {Array}
- Source:
finds associated Navigator by Path route Name
Parameters:
Name | Type | Description |
---|---|---|
_route |
string |
Returns:
- NavigatorID Array
- Type
- Array
findNavigatorParent(_navigatorId) → {string}
- Source:
finds associated Navigator Parent by navigator ID
Parameters:
Name | Type | Description |
---|---|---|
_navigatorId |
string |
Returns:
- Parent ID
- Type
- string
findViewStack(_route) → {string}
- Source:
finds associated ViewStack by Path route Name
Parameters:
Name | Type | Description |
---|---|---|
_route |
string |
Returns:
- ViewStack ID
- Type
- string
printRoutes()
- Source:
prints path Routes
reset()
- Source:
Remove and Resets existing path routes