Created
February 5, 2013 23:13
-
-
Save gigafied/4718601 to your computer and use it in GitHub Desktop.
routing refactor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = { | |
selectors : ["[data-route]"], | |
}, | |
modalConfig = { | |
selectors : ["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