]> source.dussan.org Git - nextcloud-server.git/commitdiff
debounce the search function
authorRobin Appelman <icewind@owncloud.com>
Tue, 8 Jul 2014 13:42:58 +0000 (15:42 +0200)
committerRobin Appelman <icewind@owncloud.com>
Tue, 8 Jul 2014 13:42:58 +0000 (15:42 +0200)
core/js/js.js

index 72b65f41a16f417615805d979a5288f9ff81b649..4a9a5ce82ffbeef3fed65de46632aca94dca18d1 100644 (file)
@@ -380,7 +380,7 @@ var OC={
         * Do a search query and display the results
         * @param {string} query the search query
         */
-       search:function(query){
+       search: _.debounce(function(query){
                if(query){
                        OC.addStyle('search','results');
                        $.getJSON(OC.filePath('search','ajax','search.php')+'?query='+encodeURIComponent(query), function(results){
@@ -388,7 +388,7 @@ var OC={
                                OC.search.showResults(results);
                        });
                }
-       },
+       }, 500),
        dialogs:OCdialogs,
        mtime2date:function(mtime) {
                mtime = parseInt(mtime,10);