Skip to content

Instantly share code, notes, and snippets.

@mxriverlynn
Created June 6, 2012 18:28
Show Gist options
  • Save mxriverlynn/2883744 to your computer and use it in GitHub Desktop.
Save mxriverlynn/2883744 to your computer and use it in GitHub Desktop.
add initializers to marionette module
// v0.9.0 of Marionettte will strip down the Modules to bare minimums, removing
// the ability to add initializers. you can re-add them to your module, as-needed,
// by doing this:
MyApp.module("Foo", function(Foo, MyApp, Backbone, Marionette){
var initCallbacks = new Marionette.Callbacks();
Foo.addInitializer = function(initializer){
initCallbacks.add(initializer);
}
Foo.start = function(options){
initCallbacks.run(options, Foo);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment