-
Notifications
You must be signed in to change notification settings - Fork 152
Add queueMicrotask() #3033
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
base: main
Are you sure you want to change the base?
Add queueMicrotask() #3033
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this perhaps be a feature called "Microtasks"?
Points in favor:
- MDN has a "microtask guide"
- There are quite a lot of questions that use the term (and "macrotask") on Stack Overflow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are no other developer-exposed ways to use microtasks than via the queueMicroTask
, then I agree with this suggestion. Let's re-id and re-name this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The concept of microtasks is much, much older than queueMicroTask()
, so I think it would be confusing to name it just microtasks. IIRC, the concept was formalized when promises were introduced, but there were similar "delay this work until just before we return to the event loop" concepts around before that too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The counter argument I can see is that, before queueMicrotask
, microtasks where only a concept, or a thing browsers did internally, rather than an API developers can use. If this description is correct, then I don't see much confusion in renaming the feature to microtasks, because that word never really matched with anything devs could do before.
Not a hill I will die on though. Happy to keep the proposed name too.
I remember doing setTimeout(1)
years ago, is that how we used to queue microtasks before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are no other developer-exposed ways to use microtasks than via the queueMicroTask
, then I agree with this suggestion. Let's re-id and re-name this.
Co-authored-by: Daniel D. Beck <[email protected]>
No description provided.