Skip to content

Instantly share code, notes, and snippets.

@mudkipme
Created August 13, 2013 16:35
Show Gist options
  • Save mudkipme/6222982 to your computer and use it in GitHub Desktop.
Save mudkipme/6222982 to your computer and use it in GitHub Desktop.
Extend Marionette.Application for async initialization
define([
'underscore'
,'marionette'
], function(_, Marionette){
var $ = Marionette.$;
// Extend Marionette.Application for async initialization
var AppBase = Marionette.Application.extend({
constructor: function(options){
Marionette.Application.prototype.constructor.apply(this, options);
this._deferredInits = [];
}
,addAsyncInitializer: function(initializer){
this._deferredInits.push(initializer);
}
,start: function(options){
var me = this;
me.triggerMethod("initialize:before", options);
$.when.apply($, _.map(me._deferredInits, function(initializer){
return $.Deferred(function(dfd){
initializer.call(me, dfd, options);
});
})).done(function(){
me._initCallbacks.run(options, me);
me.triggerMethod("initialize:after", options);
me.triggerMethod("start", options);
});
}
});
return AppBase;
});
@Bellaliz
Copy link

Hi Dear, My name is Ella, l saw your profile today after going through it then l made up my mind to contact you as my friend. so l want you to write back to me through my address ([email protected]) for security reason's which i will let you know when we become the best of friends. to enable me give you my picture and for you to know more about me. I hope to see your mail soon.
"Remember that Age,region distance or color does not matter when it comes to
true friendship" my email ([email protected])

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