Просмотр исходного кода

Make `initialized` a promise and use it in the controlbox

JC Brand 8 лет назад
Родитель
Сommit
956340aa8c
2 измененных файлов с 3 добавлено и 2 удалено
  1. 2 2
      src/converse-controlbox.js
  2. 1 0
      src/converse-core.js

+ 2 - 2
src/converse-controlbox.js

@@ -735,12 +735,12 @@
                     _converse.chatboxviews.$el.prepend(this.render());
                     this.updateOnlineCount();
                     const that = this;
-                    _converse.on('initialized', function () {
+                    _converse.api.waitUntil('initialized').then(() => {
                         _converse.roster.on("add", that.updateOnlineCount, that);
                         _converse.roster.on('change', that.updateOnlineCount, that);
                         _converse.roster.on("destroy", that.updateOnlineCount, that);
                         _converse.roster.on("remove", that.updateOnlineCount, that);
-                    });
+                    }).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
                 },
 
                 render () {

+ 1 - 0
src/converse-core.js

@@ -150,6 +150,7 @@
     };
 
     const PROMISES = [
+        'initialized',
         'cachedRoster',
         'pluginsInitialized',
         'roster',