Skip to content

Instantly share code, notes, and snippets.

@sms-system
Created September 16, 2016 08:01
Show Gist options
  • Save sms-system/37313fd3a3d542113dba9eb3cd2d102b to your computer and use it in GitHub Desktop.
Save sms-system/37313fd3a3d542113dba9eb3cd2d102b to your computer and use it in GitHub Desktop.
Throttling function
const throttle = (callback, limit) => {
let wait = false
return function() {
if (!wait) {
callback.call(this)
wait = true
setTimeout(() => wait = false, limit)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment