Skip to content

Instantly share code, notes, and snippets.

@mmarum-sugarcrm
Created March 21, 2015 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmarum-sugarcrm/ec2abc261c935ac5e278 to your computer and use it in GitHub Desktop.
Save mmarum-sugarcrm/ec2abc261c935ac5e278 to your computer and use it in GitHub Desktop.
Use of _.debounce() in Sugar 7.5 filter-quicksearch.js
({
...
/**
* Fire quick search
* @param {Event} e
*/
throttledSearch: _.debounce(function(e) {
var newSearch = this.$el.val();
if(this.currentSearch !== newSearch) {
this.currentSearch = newSearch;
this.layout.trigger('filter:apply', newSearch);
}
}, 400),
...
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment