Class: Router

Router(homeFunc)

This is the Router class which contains routing functions for each page/component. This is where the navigation functions are stored and occured.

Constructor

new Router(homeFunc)

Sets up the home function, the page name should always be 'home', which is why no page name variable is passed in.
Parameters:
Name Type Description
homeFunc function The function to run to set the home route visually
Source:

Classes

Router

Methods

addPage(page, pageFunc)

Adds a page name & function so to the router so that the function can be called later when the page is passed in
Parameters:
Name Type Description
page String The name of the page to route to (this is used as the page's hash as well in the URL)
pageFunc function The function to run when the page is called
Source:
Changes the page visually to the page that has been passed in. statePopped is used to avoid pushing a new history state on back/forward button presses
Parameters:
Name Type Description
page String The name of the page to route to
statePopped Boolean True if this function is being called from a 'popstate' event instead of a normal card click
Source: