Router
Extends:
Direct Subclass:
Abstract Router class which can be implemented to be used in an MVP setup.
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
controllers: * |
|
public |
|
|
public |
|
Method Summary
Public Methods | ||
public |
Registers a single controller. |
|
public |
Triggers navigation to one of the controllers |
|
public |
On a route change, calls the corresponding controller method with the given parameter values. |
|
public |
setDefault(controller: Controller | Function | String, method: String): void Sets the initial controller and method to be activated whenever the controllers are activated. |
Public Constructors
public constructor source
Public Members
public controllers: * source
Public Methods
public add(route: String, handler: Function): void source
Registers a single controller.
Return:
void |
public go(controller: Controller | Function | String, method: String, params: Object): void source
Triggers navigation to one of the controllers
Params:
Name | Type | Attribute | Description |
controller | Controller | Function | String | The controller instance, controller constructor, or controller name to go to. |
|
method | String | The method to call in given controller. |
|
params | Object | Dictonary of key-value pairs containing named arguments (i.e. {id: 1, test: "yes"}) |
Return:
void |
public run(): Boolean source
On a route change, calls the corresponding controller method with the given parameter values.
public setDefault(controller: Controller | Function | String, method: String): void source
Sets the initial controller and method to be activated whenever the controllers are activated.
Params:
Name | Type | Attribute | Description |
controller | Controller | Function | String | Default controller instance, controller constructor, or controller name to go to. |
|
method | String | Default method to call in given controller. |
Return:
void |