Skip to content

Instantly share code, notes, and snippets.

@nashvail
Created June 23, 2015 10:52
Show Gist options
  • Save nashvail/8ef924eed142502f451f to your computer and use it in GitHub Desktop.
Save nashvail/8ef924eed142502f451f to your computer and use it in GitHub Desktop.
JavaScript debounce function.
function debounce(fn, duration) {
var timeout;
return function() {
clearTimeout(timeout);
timeout = setTimeout(fn, duration);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment