Created
May 27, 2015 10:20
-
-
Save srtab/cb2d984df6c72918c83b to your computer and use it in GitHub Desktop.
Throttle 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
function throttle(func, delay) { | |
var wait = false; | |
return function () { | |
if (!wait) { | |
func.call(); | |
wait = true; | |
setTimeout(function () { | |
wait = false; | |
}, delay); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment