Created
December 20, 2017 15:13
-
-
Save stevenpray/415fede6a688fcf9a1ae0b29095a1290 to your computer and use it in GitHub Desktop.
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
'use strict'; | |
function debounce(func, wait) { | |
let timeout | |
return function (...args) { | |
const _this = this | |
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