refactor async code of the emoji-picker

This commit is contained in:
Joffrey JAFFEUX 2017-07-19 22:54:43 +02:00
parent ce982d9935
commit d27f744d16
1 changed files with 2 additions and 10 deletions

View File

@ -115,21 +115,13 @@ export default Ember.Component.extend({
this._bindEvents();
this._later(this, function() {
Ember.run.scheduleOnce('afterRender', this, function() {
this._setDiversity();
this._positionPicker();
this._scrollTo();
});
},
_later(context, handler, timeout) {
if(Ember.testing) {
handler.bind(context)();
} else {
Ember.run.later(context, handler, timeout);
}
},
_bindEvents() {
this._bindDiversityClick();
this._bindSectionsScroll();
@ -322,7 +314,7 @@ export default Ember.Component.extend({
if(preloadedSection && !preloadedSection.$section.hasClass("loaded")) {
preloadedSection.$section.addClass("loaded");
const $visibleEmojis = preloadedSection.$section.find(".emoji[src='']");
this._later(this, function() { this._loadVisibleEmojis($visibleEmojis); }, 1500);
Ember.run.later(this, () => this._loadVisibleEmojis($visibleEmojis), 1500);
}
}
},