Last active
February 16, 2016 01:50
-
-
Save 1Marc/4770184 to your computer and use it in GitHub Desktop.
Pseudocode demonstrating debouncing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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