-
Notifications
You must be signed in to change notification settings - Fork 25
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
Return promise from setTimeout #35
Comments
How would you approach using |
It would probably work better to just add a wait function, and it could be part of a sensibly named global object rather than |
Good point, though I'm not sure it's even needed in those cases. It's possible to add another callback to retrieve the timer (i.e. |
This repository is intended more for standard library infrastructure, as explained in https://github.com/tc39/proposal-javascript-standard-library#scope . If you want to chat about new features, Issue #16 is intended for that. Note that setTimeout is a web platform feature, defined in the HTML specification, not a TC39 feature. You'd be better taking up your feature request there. |
For anyone looking into this.. here is the relevant issue for the HTML spec whatwg/html#617 |
I find myself write the following snippet in almost any project I start:
That way I can use
await wait(500)
to delay the execution of the next lines of an async function by 500 milliseconds.Since I find myself rewriting it every time, I figured it might as well be natively supported by returning a promise from
setTimeout
:The text was updated successfully, but these errors were encountered: