Skip to content

Instantly share code, notes, and snippets.

@gigafied
Last active December 11, 2015 14:09
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 gigafied/4612577 to your computer and use it in GitHub Desktop.
Save gigafied/4612577 to your computer and use it in GitHub Desktop.
define (
[
"rosy/base/Class",
"rosy/routing/Router",
"rosy/routing/HistoryRouter",
"rosy/routing/HashRouter",
"mySite/views/About"
],
function (Class, Router, HistoryRouter, HashRouter, About) {
return Class.extend({
mainRouter : null,
modalRouter : null,
historyRouter : null,
hashRouter : null,
init : function () {
var mainConfig = {
routeAttr : ["data-route", "href"]
},
modalConfig = {
routeAttr : ["data-modal-route"]
};
this.mainRouter = new Router([
{
path : "/home",
viewClass : "/mySite/views/Home",
config : {
some : "thing"
}
},
{
path : "/about",
viewClass : About,
config : {
some : "thing else"
}
}
], mainConfig);
this.modalRouter = new Router([
{
path : "/videos",
viewClass : "/mySite/views/modals/Videos",
config : {
some : "thing"
}
},
{
path : "/contact",
viewClass : "mySite/views/modals/Contact",
config : {
some : "thing else"
}
}
], modalConfig);
this.historyRouter = new HistoryRouter();
this.historyRouter.link(this.mainRouter);
this.hashRouter = new HashRouter();
this.hashRouter.link(this.modalRouter);
}
});
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment