Skip to content

Instantly share code, notes, and snippets.

@mmoehrlein
Created November 24, 2021 14:22
Show Gist options
  • Save mmoehrlein/fa660dff7defc72428e979588a27ff20 to your computer and use it in GitHub Desktop.
Save mmoehrlein/fa660dff7defc72428e979588a27ff20 to your computer and use it in GitHub Desktop.
ts - promise based sleep
/**
* 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