Skip to content

Instantly share code, notes, and snippets.

@luciopaiva
Created May 3, 2018 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luciopaiva/d7fe9d02e6d8d909253864469d65c487 to your computer and use it in GitHub Desktop.
Save luciopaiva/d7fe9d02e6d8d909253864469d65c487 to your computer and use it in GitHub Desktop.
Javascript: sleep()
/**
* Asynchronously sleep for the specified amount of time.
* @param {Number} millis
* @return {Promise}
*/
function sleep(millis) {
return new Promise(resolve => setTimeout(resolve, millis));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment