Explorar o código

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

JC Brand %!s(int64=9) %!d(string=hai) anos
pai
achega
f4c1e0916e
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      src/converse-controlbox.js

+ 2 - 2
src/converse-controlbox.js

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