Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Snippet] - JavaScript Sleep #87

Open
shanejix opened this issue Jan 10, 2022 · 0 comments
Open

[Snippet] - JavaScript Sleep #87

shanejix opened this issue Jan 10, 2022 · 0 comments
Labels

Comments

@shanejix
Copy link
Owner

shanejix commented Jan 10, 2022

同步链接: https://www.shanejix.com/posts/[Snippet] - JavaScript Sleep/

const sleep = (milliseconds) => {
  return new Promise((resolve) => setTimeout(resolve, milliseconds));
};

usage:

await sleep(1000);

作者:shanejix
出处:https://www.shanejix.com/posts/[Snippet] - JavaScript Sleep/
版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。
声明:转载请注明出处!

@shanejix shanejix changed the title [Snippet] - javascript sleep [Snippet] - JavaScript Sleep Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant