Skip to content

Instantly share code, notes, and snippets.

@eugenserbanescu
Created September 26, 2017 13:52
Show Gist options
  • Save eugenserbanescu/8522360a4c6a044180562596f6c8a38a to your computer and use it in GitHub Desktop.
Save eugenserbanescu/8522360a4c6a044180562596f6c8a38a to your computer and use it in GitHub Desktop.
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