ClientRouter

router/ClientRouter~ ClientRouter

The client-side implementation of the Router interface.

Constructor

new ClientRouter(pageManager, factory, dispatcher, window)

Source:
Initializes the client-side 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.
window Window The current global client-side APIs provider.

Members

_window :Window

Source:
Helper for accessing the native client-side APIs.
Type:
  • Window

Methods

_getAnchorElement(target) → (nullable) {Node}

Source:
The method determines whether an anchor element or a child of an anchor element has been clicked, and if it was, the method returns anchor element else null.
Parameters:
Name Type Description
target Node
Returns:
Type
Node

_handleClick(event)

Source:
Handles a click event. The method performs navigation to the target location of the anchor (if it has one). The navigation will be handled by the router if the protocol and domain of the anchor's target location (href) is the same as the current, otherwise the method results in a hard redirect.
Parameters:
Name Type Description
event MouseEvent The click event.

_handleFatalError(error)

Source:
Handle a fatal error application state. IMA handle fatal error when IMA handle error.
Parameters:
Name Type Description
error Error
Source:
Tests whether the provided target URL contains only an update of the hash fragment of the current URL.
Parameters:
Name Type Description
targetUrl string The target URL.
Returns:
true if the navigation to target URL would result only in updating the hash fragment of the current URL.
Type
boolean

_isSameDomain(urlopt) → {boolean}

Source:
Tests whether the the protocol and domain of the provided URL are the same as the current.
Parameters:
Name Type Attributes Default Description
url string <optional>
'' The URL.
Returns:
true if the protocol and domain of the provided URL are the same as the current.
Type
boolean

_saveScrollHistory()

Source:
Save user's scroll state to history. Replace scroll values in current state for actual scroll values in document.

_setAddressBar(url)

Source:
Sets the provided URL to the browser's address bar by pushing a new state to the history. The state object pushed to the history will be an object with the following structure: {url: string}. The url field will be set to the provided URL.
Parameters:
Name Type Description
url string The URL.

getPath()

Source:

getUrl()

Source:

handleError()

Source:

handleNotFound()

Source:

init()

Source:

listen()

Source:

redirect()

Source:

route()

Source: