Skip to content

Instantly share code, notes, and snippets.

@dSalieri
Last active July 24, 2021 23:36
Show Gist options
  • Save dSalieri/6a3c1ecd8065976712102be3ff7b00df to your computer and use it in GitHub Desktop.
Save dSalieri/6a3c1ecd8065976712102be3ff7b00df to your computer and use it in GitHub Desktop.
Light template of debounce
function debounce(func, delay) {
let timerId;
return function (args) {
clearTimeout(timerId);
timerId = setTimeout(function () {
func(args);
}, delay);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment