Skip to content

Instantly share code, notes, and snippets.

@MauricioRobayo
Last active May 20, 2021 15:40
Show Gist options
  • Save MauricioRobayo/2331d016e7fd716135593e18898fb001 to your computer and use it in GitHub Desktop.
Save MauricioRobayo/2331d016e7fd716135593e18898fb001 to your computer and use it in GitHub Desktop.
#gogofast
const debounce = (func, delay) => {
let timeout = null;
return (...args) => {
clearTimeout(timeout);
timeout = setTimeout(() => {
func.apply(this, args);
}, delay);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment