Skip to content

Instantly share code, notes, and snippets.

@Haosvit
Created February 19, 2020 14:23
Show Gist options
  • Save Haosvit/417e42afc03f2ebcf115cf26f721c8e7 to your computer and use it in GitHub Desktop.
Save Haosvit/417e42afc03f2ebcf115cf26f721c8e7 to your computer and use it in GitHub Desktop.
debounce
private debounce = (func: (...args: any) => void, wait: number) => {
let timeout;
return (...args: any) => {
clearTimeout(timeout);
timeout = setTimeout(() => func.apply(this, args), wait);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment