PageManager is a singleton class that manages front-end routing (based on Page.js), page transitions and page loading.
;pmlocales = 'en' 'fr';pmautoRouting = true;pm;pm;pm;pm;pm;pm;pm;// Begin routing after all requirements are defined. Comment out this line if// you do not want routing enabled.pm;
The ID attribute of the DOM element that wraps the page.
When this property is
true, PageManager automatically sets up a series of universal middlewares for all routes which handles page transitions, AJAX loading of other pages and injecting the loaded markup into an element with ID
#page. This ID can be changed via the property
PageManager.targetElementID. The order of auto-routing routines goes like this:
- User clicks on a link that triggers a URL change.
- PageManager picks up the change and injects the new URL into the history stack for tracking page history.
- Address bar and window title change to reflect new URL.
- PageManager transitions out the current page, if a transition is defined.
- PageManager sends a GET request to load the new page, processes the HTML text in the response body, and either:
- Replaces the entire with the of the loaded page if there is a locale change, or
- Replaces the entire with theof the loaded page if there is no locale change.
- PageManager invokes a transition in for the new page, if one is defined.
- End of the routing sequence.
This property can also be set to
#, which would enable hashbangs for Page.js.
To disable routing altogether, ensure that
autoRouting is set to
false and do not invoke
Client-side routing is based on Page.js. This method is equivalent to Page.js's
transition(type, fromPath/toPath/handler[, toPath/handler, handler])
type - Either
in means transition-in and
out means transition-out.
fromPath - The path which the page is transitioning from.
toPath - The path which the page is transitioning into.
handler - The async function invoked during the transition. A callback is automatically passed into this handler, which should be called manually to notify that transition is complete.
toPath are optional, which both are defaulted to
/*. When only 3 arguments are passed into this function, the second argument is
fromPath for an
out transition and
toPath for an
This software is released under the MIT License.