JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
<script src="http://documentcloud.github.com/backbone/backbone-min.js"></script>
<script src="https://raw.github.com/douglascrockford/JSON-js/master/json2.js"></script>
JavaScript
var dummy = Backbone.Router.extend({
defaultPage: 'messages',
routes: {
'': 'index',
'index': 'index',
'mailbox': 'mailbox'
},
index: function() {
// code here
},
mailbox: function() {
// code here
}
});
var router = new dummy();
router.bind('all', function(route) {
document.write('triggered: ' + route + '<br/>');
});
router.navigate('index', true);
router.navigate('mailbox', true);