-
-
Save mohammedri/7d8060819ab8c396c012 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