AbstractRouter

router/AbstractRouter~ AbstractRouter

The basic implementation of the Router interface, providing the common or default functionality for parts of the API.

Constructor

(abstract) new AbstractRouter(pageManager, factory, dispatcher)

Source:
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

Source:
Dispatcher fires events to app.
Type:
  • Dispatcher

_factory :RouteFactory

Source:
Factory for routes.
Type:
  • RouteFactory

_host :string

Source:
The application's host.
Type:
  • string

_languagePartPath :string

Source:
The URL path fragment used as a suffix to the _root field that specifies the current language.
Type:
  • string

_pageManager :PageManager

Source:
The page manager handling UI rendering, and transitions between pages if at the client side.
Type:
  • PageManager

_protocol :string

Source:
The current protocol used to access the application, terminated by a colon (for example https:).
Type:
  • string

_root :string

Source:
The URL path pointing to the application's root.
Type:
  • string

_routes :Map.<string, Route>

Source:
Storage of all known routes. The key are the route names.
Type:
  • Map.<string, Route>

Methods

(protected) _extractRoutePath(path) → {string}

Source:
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) → (nullable) {Route}

Source:
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) → {Promise.<Object.<string, *>>}

Source:
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()

Source:

getBaseUrl()

Source:

getCurrentRouteInfo()

Source:

getDomain()

Source:

getHost()

Source:

getPath()

Source:

getProtocol()

Source:

getUrl()

Source:

handleError()

Source:

handleNotFound()

Source:

init()

Source:

isClientError()

Source:

isRedirection()

Source:
Source:

(abstract) listen()

Source:

(abstract) redirect()

Source:

remove()

Source:

route()

Source: