Skip to content

Instantly share code, notes, and snippets.

@a-axton
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save a-axton/9402641 to your computer and use it in GitHub Desktop.

Select an option

Save a-axton/9402641 to your computer and use it in GitHub Desktop.
Creating a marionette module that can be placed within other areas of the application via Foo.display
// Application.js file
var MyApp = new Backbone.Marionette.Application();
MyApp.addRegions({
someRegion: "#some-div"
});
MyApp.addInitializer(function(options){
if(options.somethingOrOther) {
MyApp.Foo.display(MyApp.someRegion);
}
});
// Foo module.js files
MyApp.module("Foo", function(Foo, App){
Foo.addInitializer(function(){
// Do things once the module has started
});
// layout can be subbed as different view type
var layout = Backbone.Marionette.Layout.extend({
});
// function to display module inside of another
Foo.display = function (region) {
region.show(new layout());
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment