Forked from kimmobrunfeldt/underscore-debounce-example.js
Created
December 27, 2017 12:27
-
-
Save IvanTorresEdge/334dd62c12fa007f6f00934f0dbec056 to your computer and use it in GitHub Desktop.
Example of using Underscore's _.debounce function
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
// Example of using Underscore's _.debounce function | |
// debounce is useful for situations where you get multiple events fired | |
// from one action. For example resize event is sent multiple times when | |
// window is resized | |
var reloadIfResizeChange = _.debounce(function() { | |
window.location.reload(); | |
}, 200); | |
window.addEventListener('resize', reloadIfResizeChange); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment