addRoute (name, route)
Adds a new route. The correct format is verified.
Parameters:
Name |
Type |
Description |
name |
string
|
Route name. |
route |
Object
|
Route object. |
Throws:
-
Exception if route has an invalid format.
|
createRoute (request) → {Object}
Creates the Route object from request. This one is not saved as named route.
Parameters:
Name |
Type |
Description |
request |
string
|
Object
|
Request string or route-like object. |
Throws:
Returns:
|
getRoute (name) → {Object|null}
Gets a saved Route object or null.
Parameters:
Name |
Type |
Description |
name |
string
|
Route name. |
Returns:
-
Object
|
null
:
Route object or null.
|
hasRoute (name) → {boolean}
Checks if the router has a saved route of this name.
Parameters:
Name |
Type |
Description |
name |
string
|
Route name. |
Returns:
|
removeRoute (name)
Parameters:
Name |
Type |
Description |
name |
string
|
Route name. |
|
setRoutes (routes)
Saves a set of routes and replaces existing route set. The correct format is verified.
Parameters:
Name |
Type |
Description |
routes |
Object
|
Set of routes in the form {name1: route1, name2: route2, ...} . |
Throws:
-
Exception if routes has an invalid format.
|
toString () → {string}
Returns a string representation of the object.
Returns:
|