Skip to content

Instantly share code, notes, and snippets.

@Drew-Killeen
Last active January 15, 2024 15:35
Show Gist options
  • Save Drew-Killeen/e068372199a9bb4265aa793ebe68c2fb to your computer and use it in GitHub Desktop.
Save Drew-Killeen/e068372199a9bb4265aa793ebe68c2fb to your computer and use it in GitHub Desktop.
TypeScript debounce function
function debounce (callback: Function, duration: number, timer: number) {
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(callback, duration);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment