Skip to content

Instantly share code, notes, and snippets.

@luciopaiva
Created May 3, 2018
Embed
What would you like to do?
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