Skip to content

Instantly share code, notes, and snippets.

@1Marc
Last active February 16, 2016 01:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save 1Marc/4770184 to your computer and use it in GitHub Desktop.
Save 1Marc/4770184 to your computer and use it in GitHub Desktop.
Pseudocode demonstrating debouncing.
// Pseudocode to demonstrate debouncing
$(".item_column").on("scroll", function(){
// this function fires way too fast
getItemsInView();
});
// With debouncing:
$(".item_column").on("scroll", _.debounce(function(){
// max this function can fire is every 150 milliseconds
getItemsInView();
}, 150);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment