Created
September 16, 2015 21:50
-
-
Save anextro/87814b4771d34d76e901 to your computer and use it in GitHub Desktop.
Excerpts from a Marionette Application
This file contains 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
rootview: null, | |
initialize: function(){ | |
//build rootivew and render empty content | |
this.rootview = new RootView().render(); | |
this._setupManagers(); | |
this.on("start", this._onStart); | |
}, | |
_setupManagers: function(){ | |
new BaseManager({rootview: this.rootview}); | |
new LayoutManager(); | |
}, | |
_onStart: function(){ | |
if(Backbone.history){ | |
console.log("backbone history starting"); | |
Backbone.history.start({pushState:true}); | |
$(document).on('click', 'a[href]:not([data-bypass])', function (evt) { | |
evt.preventDefault(); | |
var href = $(this).attr('href'); | |
console.log("backbone history doing something"+ href); | |
Backbone.history.navigate(href, { trigger: true }); | |
}); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Application Mediator. The role is to instantiate core subsystems of the application.