Created
March 31, 2019 11:00
-
-
Save ZackFox/3818d8c8eb4484754d6156f78053ea5b 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
function debounce(func,delay = 200){ | |
let timer = null; | |
return function(...args){ | |
if(timer){ | |
clearTimeout(timer); | |
} | |
timer = setTimeout(() => { | |
func.apply(null,args) | |
}, delay); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment