Created
September 26, 2017 13:52
-
-
Save eugenserbanescu/8522360a4c6a044180562596f6c8a38a 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 setTimeout(callback, timeout) { | |
let startTime = Date.now(); | |
function loop(){ | |
if (Date.now() >= startTime + timeout) { | |
callback(); | |
} else { | |
loop(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment