Skip to content

Instantly share code, notes, and snippets.

@sagar-ganatra
Created April 29, 2014 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sagar-ganatra/11391534 to your computer and use it in GitHub Desktop.
Save sagar-ganatra/11391534 to your computer and use it in GitHub Desktop.
function loadPage (ctx, next) {
//show the home page if at the root path
if(ctx.path === '/' ) {
PageManager.loadPage('home');
} else {
//load the page based on the selected route
PageManager.loadPage(ctx.path.slice(1), ctx);
}
//once the page is loaded invoke the next callback function
next();
}
function triggerPageChangeEvent (ctx) {
//trigger a pageChange event
MessageBus.trigger('pageChange', ctx.path.slice(1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment