Created
August 8, 2018 11:48
-
-
Save chy4egg/a6b755a0185d57baeb2980ffd72ad86d to your computer and use it in GitHub Desktop.
Function that delays something
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
export default (function fnDelay(){ | |
var timer = 0; | |
return function(callback, ms){ | |
clearTimeout(timer); | |
timer = setTimeout(callback, ms); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment