Skip to content

Instantly share code, notes, and snippets.

@anextro
Created September 16, 2015 21:50
Show Gist options
  • Save anextro/87814b4771d34d76e901 to your computer and use it in GitHub Desktop.
Save anextro/87814b4771d34d76e901 to your computer and use it in GitHub Desktop.
Excerpts from a Marionette Application
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 });
});
}
}
});
@anextro
Copy link
Author

anextro commented Sep 16, 2015

The Application Mediator. The role is to instantiate core subsystems of the application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment