new Router(routes)
Represents a Router to load a route
Parameters:
| Name | Type | Description |
|---|---|---|
routes | Object | The routes of the app |
- Source
Example
const myRouter = new Router(routes);Methods
init() → {void}
Init the router to get the current path and load the cooresponding view
- Source
Returns:
- Type:
- void
(async) loadRoute(pathName) → {void}
Load the corresponding view according to the pathName given
Parameters:
| Name | Type | Description |
|---|---|---|
pathName | route | The name of the path to load |
- Source
Returns:
- Type:
- void