Created
November 24, 2021 14:22
-
-
Save mmoehrlein/fa660dff7defc72428e979588a27ff20 to your computer and use it in GitHub Desktop.
ts - promise based sleep
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
/** | |
* Sleep for the specified number of milliseconds. | |
* | |
* @param ms time to sleep in milliseconds | |
* @returns {void} | |
*/ | |
async function sleep(ms: number){ | |
return new Promise((resolve) => { | |
setTimeout(resolve, ms); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment