Created
May 2, 2014 14:51
-
-
Save kimmobrunfeldt/905261a9fa96f640182c 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