Skip to content

Instantly share code, notes, and snippets.

@guoshuai93
Last active June 30, 2022 06:34
Show Gist options
  • Save guoshuai93/0fc4d055fca2aa3dafe74de32a1c585c to your computer and use it in GitHub Desktop.
Save guoshuai93/0fc4d055fca2aa3dafe74de32a1c585c to your computer and use it in GitHub Desktop.
[js_util]
function sleep(ms: number = 3000): Promise<string> {
return new Promise((resolve, reject) => {
setTimeout(resolve, ms, 'done')
})
}
sleep(1500).then(val => console.log(val))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment