diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-06-19 16:47:21 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-06-19 23:54:00 +0200 |
commit | 8f88c5acdd4985e89df13c182db0dee67da0fa21 (patch) | |
tree | 7b14f1f1eef42d0834e37542bad270b52651c16a /core/search | |
parent | 4fc9bdea4e93f0965397548d9a134964907bccb6 (diff) | |
download | nextcloud-server-8f88c5acdd4985e89df13c182db0dee67da0fa21.tar.gz nextcloud-server-8f88c5acdd4985e89df13c182db0dee67da0fa21.zip |
Debounce search and reset
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'core/search')
-rw-r--r-- | core/search/js/search.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/search/js/search.js b/core/search/js/search.js index 60316fcc46f..20d7f0f915f 100644 --- a/core/search/js/search.js +++ b/core/search/js/search.js @@ -86,15 +86,15 @@ // Register input event document .getElementById('searchbox') - .addEventListener('input', this.search, true); + .addEventListener('input', _.debounce(this.search, 500), true); document .querySelector('form.searchbox') - .addEventListener('submit', this.search, true); + .addEventListener('submit', _.debounce(this.search, 500), true); // Register reset document .querySelector('form.searchbox') - .addEventListener('reset', this.reset, true); + .addEventListener('reset', _.debounce(this.reset, 500), true); // Register esc key shortcut reset if focused document.addEventListener('keyup', function(event) { @@ -108,7 +108,7 @@ document.getElementById('searchbox').value === '' ) { if (key === 'Escape' || key === 'Esc' || key === 27) { - self.reset(event); + _.debounce(self.reset, 500); } } }); |