Add a router to handle fragment identifier
Set up a listener of the router in the scene to update it
Start Backbone.history (eventlistener of the router) when all the project is loaded
Include router.js to all the test file
(function(root) {
"use strict";
var Backbone = root.Backbone;
var Router = root.Rkns.Router = Backbone.Router.extend({
routes: {
'': 'index',
'*params': 'setParams'
},
index: function(){
this.params = {};
},
setParams: function (parameters) {
var _this = this;
this.params = {};
parameters.split('&').forEach(function(param){
_this.params[param.split('=')[0]] = param.split('=')[1] || null;
_this.trigger(param.split('=')[0], param.split('=')[1]);
});
}
});
})(window);