Browse Source

adding debounce to algolia search

Dave Gandy 9 years ago
parent
commit
8db4458ab5
2 changed files with 1 additions and 1 deletions
  1. BIN
      assets/font-awesome-4.4.0.zip
  2. 1 1
      assets/js/search.js

BIN
assets/font-awesome-4.4.0.zip


+ 1 - 1
assets/js/search.js

@@ -1,7 +1,6 @@
 $(function() {
     var SearchView = Backbone.View.extend({
         events: {
-            "keyup #search-input": "search",
             "click #search-clear": "clear"
         },
 
@@ -15,6 +14,7 @@ $(function() {
             this.$searchInputClear = this.$("#search-clear");
             this.$iconsSection = this.$("#icons");
 
+            this.$searchInput.on("keyup", _.debounce(_.bind(this.search, this), 200));
             this.algoliaHelper.on("result", _.bind(this.showResults, this));
         },