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

Avoiding magic when calling callbacks #4

Open
jakearchibald opened this issue Feb 13, 2018 · 1 comment
Open

Avoiding magic when calling callbacks #4

jakearchibald opened this issue Feb 13, 2018 · 1 comment

Comments

@jakearchibald
Copy link

If I have a spec like:

  1. Let obj be a new object.
  2. Invoke callback with obj.
  3. Do something with obj.

…microtasks will be handled after step two. But there's no way to do this in a JavaScript implementation of the spec, as the stack won't be empty.

Either we need to spec the above in a way that prevents a microtask checkpoint after step two (which would be weird if the API is ever promoted into the HTML spec or whatever), or we need to provide a way to process microtasks synchronously.

@domenic
Copy link
Collaborator

domenic commented Feb 13, 2018

Microtasks will not be handled after step 2 unless those steps are surrounded by "queue a task" or similar, which is more rare. In that case we'd probably need some new way of queuing a task that makes it clear we're running JS code, yeah. For example "queue task: 1. prepare to run script; 2-4. your steps. 5. clean up after running script".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants