Created
February 19, 2020 14:23
-
-
Save Haosvit/417e42afc03f2ebcf115cf26f721c8e7 to your computer and use it in GitHub Desktop.
debounce
This file contains hidden or 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
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