Skip to content

Instantly share code, notes, and snippets.

@HendrikRoth
Forked from ArthurClemens/gist:1b06a661c14bdb369f7c
Last active August 29, 2015 14:20
Show Gist options
  • Save HendrikRoth/ef23d7cdddeb7c484415 to your computer and use it in GitHub Desktop.
Save HendrikRoth/ef23d7cdddeb7c484415 to your computer and use it in GitHub Desktop.
var Router = function(module, name) {
return {
controller: function() {
// Do something generic like calling Google Analytics from here
console.log("Router", name)
return new module.controller()
},
view: module.view
}
}
m.route(document.getElementById("page"), "/", {
"/": Router(app, "app"),
"/project/:id": Router(project, "project")
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment