diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2014-05-13 15:59:04 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2014-06-02 12:53:59 +0200 |
commit | 92b8344489e99899c105bd37b3e0bab9cf44176f (patch) | |
tree | 6d065607328957ba38b449d42781e4ed7d83516a /settings/js | |
parent | ec572607e136e5284991854db13b045632caafe6 (diff) | |
download | nextcloud-server-92b8344489e99899c105bd37b3e0bab9cf44176f.tar.gz nextcloud-server-92b8344489e99899c105bd37b3e0bab9cf44176f.zip |
replace setTimeout and clearTimeout handling by _.debounce
Diffstat (limited to 'settings/js')
-rw-r--r-- | settings/js/users/filter.js | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/settings/js/users/filter.js b/settings/js/users/filter.js index 403e9c00c11..bd3473d0e4d 100644 --- a/settings/js/users/filter.js +++ b/settings/js/users/filter.js @@ -41,14 +41,9 @@ UserManagementFilter.prototype.init = function() { //besides the keys, the value must have been changed compared to last //time if(valid && umf.oldVal !== umf.getPattern()) { - clearTimeout(umf.thread); - umf.thread = setTimeout( - function() { - umf.run(); - }, - 300 - ); + umf.run(); } + umf.oldVal = umf.getPattern(); }); }; @@ -57,12 +52,15 @@ UserManagementFilter.prototype.init = function() { * @brief the filter action needs to be done, here the accurate steps are being * taken care of */ -UserManagementFilter.prototype.run = function() { - this.userList.empty(); - this.userList.update(GroupList.getCurrentGID()); - this.groupList.empty(); - this.groupList.update(); -}; +UserManagementFilter.prototype.run = _.debounce(function() { + console.log(this); + this.userList.empty(); + this.userList.update(GroupList.getCurrentGID()); + this.groupList.empty(); + this.groupList.update(); + }, + 300 +); /** * @brief returns the filter String @@ -82,4 +80,4 @@ UserManagementFilter.prototype.addResetButton = function(button) { umf.filterInput.val(''); umf.run(); }); -};
\ No newline at end of file +}; |