Last active
January 4, 2022 21:15
-
-
Save kalisjoshua/d401b0b333f89e3a1d4df33d63d6379d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const debounce = (fn, delay) => { | |
let pending | |
return function postponed (...args) { | |
pending && clearTimeout(pending) | |
pending = setTimeout(fn.bind(this, ...args), delay || 200) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment