Skip to content

Instantly share code, notes, and snippets.

@Drew-Killeen
Created January 13, 2024 21:11
Show Gist options
  • Save Drew-Killeen/1dfb8a535eb17a78529c9c560e7362b5 to your computer and use it in GitHub Desktop.
Save Drew-Killeen/1dfb8a535eb17a78529c9c560e7362b5 to your computer and use it in GitHub Desktop.
TypeScript Throttle Function
function throttle(callback: Function, time: number, throttlePause: boolean) {
if (throttlePause) {
return;
}
throttlePause = true;
setTimeout(() => {
callback();
throttlePause = false;
}, time);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment