mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-28 01:56:01 -05:00
FIX: Load order bug
This commit is contained in:
parent
274743b877
commit
50fe117d7c
11 changed files with 23 additions and 18 deletions
|
@ -100,10 +100,12 @@ Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
|
|||
|
||||
@method addInitializer
|
||||
@param {Function} init the initializer to add.
|
||||
@param {Boolean} immediate whether to execute the function right away.
|
||||
Default is false, for next run loop. If unsure, use false.
|
||||
**/
|
||||
addInitializer: function(init) {
|
||||
addInitializer: function(init, immediate) {
|
||||
Discourse.initializers = Discourse.initializers || [];
|
||||
Discourse.initializers.push(init);
|
||||
Discourse.initializers.push({fn: init, immediate: !!immediate});
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -115,10 +117,14 @@ Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
|
|||
var initializers = this.initializers;
|
||||
if (initializers) {
|
||||
var self = this;
|
||||
Em.run.next(function() {
|
||||
initializers.forEach(function (init) {
|
||||
init.call(self);
|
||||
});
|
||||
initializers.forEach(function (init) {
|
||||
if (init.immediate) {
|
||||
init.fn.call(self);
|
||||
} else {
|
||||
Em.run.next(function() {
|
||||
init.fn.call(self);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,4 +29,4 @@ Discourse.addInitializer(function() {
|
|||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
}, true);
|
|
@ -5,4 +5,4 @@ Discourse.addInitializer(function() {
|
|||
Discourse.MessageBus.alwaysLongPoll = Discourse.Environment === "development";
|
||||
Discourse.MessageBus.start();
|
||||
Discourse.KeyValueStore.init("discourse_", Discourse.MessageBus);
|
||||
});
|
||||
}, true);
|
||||
|
|
|
@ -8,4 +8,4 @@ Discourse.addInitializer(function() {
|
|||
// clicking outside a bootbox modal closes it
|
||||
bootbox.backdrop(true);
|
||||
|
||||
});
|
||||
}, true);
|
|
@ -15,5 +15,5 @@ Discourse.addInitializer(function() {
|
|||
}
|
||||
});
|
||||
|
||||
});
|
||||
}, true);
|
||||
|
||||
|
|
|
@ -13,4 +13,4 @@ Discourse.addInitializer(function() {
|
|||
self.set('hasFocus', false);
|
||||
});
|
||||
|
||||
});
|
||||
}, true);
|
|
@ -3,5 +3,5 @@
|
|||
**/
|
||||
Discourse.addInitializer(function() {
|
||||
Discourse.Mobile.init();
|
||||
});
|
||||
}, true);
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
**/
|
||||
Discourse.addInitializer(function() {
|
||||
|
||||
console.log('live reloading');
|
||||
|
||||
// subscribe to any site customizations that are loaded
|
||||
$('link.custom-css').each(function() {
|
||||
var split = this.href.split("/"),
|
||||
|
@ -70,4 +68,4 @@ Discourse.addInitializer(function() {
|
|||
});
|
||||
});
|
||||
|
||||
});
|
||||
}, true);
|
|
@ -8,5 +8,5 @@ Discourse.addInitializer(function() {
|
|||
Discourse.Formatter.updateRelativeAge($('.relative-date'));
|
||||
}, 60 * 1000);
|
||||
|
||||
});
|
||||
}, true);
|
||||
|
||||
|
|
|
@ -23,4 +23,4 @@ Discourse.addInitializer(function() {
|
|||
// iPads should report as 1024.
|
||||
caps.set('highRes', Modernizr.mq("only screen and (min-width: 1280px)"));
|
||||
|
||||
});
|
||||
}, true);
|
||||
|
|
|
@ -28,5 +28,6 @@ Discourse.addInitializer(function() {
|
|||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}, true);
|
||||
|
||||
|
|
Loading…
Reference in a new issue