浏览代码

Debounce so that it doesn't get called for each fetched contact

JC Brand 9 年之前
父节点
当前提交
f4c1e0916e
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/converse-controlbox.js

+ 2 - 2
src/converse-controlbox.js

@@ -700,13 +700,13 @@
                     return this;
                     return this;
                 },
                 },
 
 
-                updateOnlineCount: function () {
+                updateOnlineCount: _.debounce(function () {
                     var $count = this.$('#online-count');
                     var $count = this.$('#online-count');
                     $count.text('('+converse.roster.getNumOnlineContacts()+')');
                     $count.text('('+converse.roster.getNumOnlineContacts()+')');
                     if (!$count.is(':visible')) {
                     if (!$count.is(':visible')) {
                         $count.show();
                         $count.show();
                     }
                     }
-                },
+                }, converse.animate ? 100 : 0),
 
 
                 hide: function (callback) {
                 hide: function (callback) {
                     this.$el.fadeOut('fast', callback);
                     this.$el.fadeOut('fast', callback);