<abstract> new AbstractRouter(pageManager, factory, dispatcher)
Initializes the router.
Parameters:
Name | Type | Description |
---|---|---|
pageManager |
PageManager | The page manager handling UI rendering, and transitions between pages if at the client side. |
factory |
RouteFactory | Factory for routes. |
dispatcher |
Dispatcher | Dispatcher fires events to app. |
Members
-
_dispatcher :Dispatcher
-
Dispatcher fires events to app.
Type:
-
_factory :RouteFactory
-
Factory for routes.
Type:
-
_host :string
-
The application's host.
Type:
- string
-
_languagePartPath :string
-
The URL path fragment used as a suffix to the
_root
field that specifies the current language.Type:
- string
-
_pageManager :PageManager
-
The page manager handling UI rendering, and transitions between pages if at the client side.
Type:
-
_protocol :string
-
The current protocol used to access the application, terminated by a colon (for example
https:
).Type:
- string
-
_root :string
-
The URL path pointing to the application's root.
Type:
- string
-
_routes :Map.<string, Route>
-
Storage of all known routes. The key are the route names.
Type:
- Map.<string, Route>
Methods
-
<protected> _extractRoutePath(path)
-
Strips the URL path part that points to the application's root (base URL) from the provided path.
Parameters:
Name Type Description path
string Relative or absolute URL path.
Returns:
URL path relative to the application's base URL.
- Type
- string
-
_getRouteByPath(path)
-
Returns the route matching the provided URL path part. The path may contain a query.
Parameters:
Name Type Description path
string The URL path.
Returns:
The route matching the path, or
null
if no such route exists.- Type
- Route
-
_handle(route, params, options)
-
Handles the provided route and parameters by initializing the route's controller and rendering its state via the route's view.
The result is then sent to the client if used at the server side, or displayed if used as the client side.
Parameters:
Name Type Description route
Route The route that should have its associated controller rendered via the associated view.
params
Object.<string, (Error|string)> Parameters extracted from the URL path and query.
options
Object The options overrides route options defined in the
routes.js
configuration file.Returns:
A promise that resolves when the page is rendered and the result is sent to the client, or displayed if used at the client side.
- Type
- Promise.<Object.<string, *>>
-
add()
-
-
getBaseUrl()
-
-
getCurrentRouteInfo()
-
-
getDomain()
-
-
getHost()
-
-
getPath()
-
-
getProtocol()
-
-
getUrl()
-
-
handleError()
-
-
handleNotFound()
-
-
init()
-
-
isClientError()
-
-
isRedirection()
-
-
link()
-
-
<abstract> listen()
-
-
<abstract> redirect()
-
-
remove()
-
-
route()
-