Skip to content

Instantly share code, notes, and snippets.

@b-aleksei
Created October 21, 2020 16:15
Show Gist options
  • Save b-aleksei/da1c4c156691e3380549f3b615a1db36 to your computer and use it in GitHub Desktop.
Save b-aleksei/da1c4c156691e3380549f3b615a1db36 to your computer and use it in GitHub Desktop.
function debounce(func, ms) { let timeout; return () => { clearTimeout(timeout); timeout = setTimeout(() => { func(); }, ms); }; debounce
function debounce(func, ms) {
let timeout;
return () => {
clearTimeout(timeout);
timeout = setTimeout(() => {
func();
}, ms);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment