Skip to content

Instantly share code, notes, and snippets.

@meleyal
Created August 3, 2010 10:55
Show Gist options
  • Save meleyal/506180 to your computer and use it in GitHub Desktop.
Save meleyal/506180 to your computer and use it in GitHub Desktop.
Hello world with route.js
route('#/hello').bind(myFunction);
function myFunction(){
alert('Hello world');
}
// route('#/hello').run();
var App={};
App._hashchange_last = '';
App._onhashchange=function(){
if(App._hashchange_last!=location.hash){
App._hashchange_last=location.hash;
route(location.hash).run();
}
}
setInterval(function () {App._onhashchange();}, 50);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment