Repository navigation
Add self.queueMicrotask() - #2789
Conversation
1e48bc3 to
e15f47c
Compare
| to perform any such manipulations. This ensures your steps are properly interleaved with respect | ||
| to other things happening on the <span>event loop</span>. Furthermore, you must choose a | ||
| <span>task source</span> when <span data-x="queue a task">queueing a task</span>; this governs the | ||
| <span>task source</span> when <span data-x="queue a task">queuing a task</span>; this governs the |
There was a problem hiding this comment.
Both are correct so we should add this to the Style Guide.
| void <span data-x="dom-clearInterval">clearInterval</span>(optional long handle = 0); | ||
|
|
||
| // microtask queuing | ||
| void <span data-x="dom-queueMicrotask">queueMicrotask</span>(<span data-x="idl-Function">Function</span> <var>callback</var>); |
There was a problem hiding this comment.
I can't see a reason why they wouldn't have this.
There was a problem hiding this comment.
I'd like to explore that separately, if so. There is no shared mixin right now so doing so is not straightforward. And from what I understand not all worklets have event loops?
There was a problem hiding this comment.
They all have an event loop I believe. They just don't queue new tasks, but that doesn't matter here.
There was a problem hiding this comment.
But also, wouldn't that mean we'd add a new mixin that encompasses all? Or would we solve it differently?
There was a problem hiding this comment.
Yeah, I don't know what the right solution is. I'd like to work on such an expansion in collaboration with the worklets editors, as a new feature, instead of holding up this (implementer consensus/tests ready/spec ready) feature on figuring out the details.
There was a problem hiding this comment.
I guess I'm okay with that, provided there's a follow-up issue. I do think it'll result in this method being moved to a new mixin, but so be it.
| <h3>Microtask queuing</h3> | ||
|
|
||
| <p>The <code data-x="dom-queueMicrotask">queueMicrotask()</code> method allows authors to schedule | ||
| a callback on the <span>microtask queue</span>. This allows their code to run after the |
There was a problem hiding this comment.
Technically it's at the end of the task, no?
There was a problem hiding this comment.
I'd call step 6 "after" step 3 in https://html.spec.whatwg.org/#event-loop-processing-model
| browser's <span>event loop</span>, as would be the case when using, for example, <code | ||
| data-x="dom-setTimeout">setTimeout(<var>f</var>, 0)</code>.</p> | ||
|
|
||
| <p>Authors should be aware that scheduling a lot of microtasks has the same performance downsides |
e15f47c to
f2b6ae3
Compare
|
(This also still needs implementation bugs.) |
…stonly Automatic update from web-platform-testsAdd tests for self.queueMicrotask() Follows whatwg/html#2789. -- wpt-commits: 0c3bed38df6d9dcd1441873728fb5c1bb59c92df wpt-pr: 6334
…stonly Automatic update from web-platform-testsAdd tests for self.queueMicrotask() Follows whatwg/html#2789. -- wpt-commits: 0c3bed38df6d9dcd1441873728fb5c1bb59c92df wpt-pr: 6334
…stonly Automatic update from web-platform-testsAdd tests for self.queueMicrotask() Follows whatwg/html#2789. -- wpt-commits: 0c3bed38df6d9dcd1441873728fb5c1bb59c92df wpt-pr: 6334 UltraBlame original commit: 141be436c496b0715eac4f3a7c0c6a0c25392a59
…stonly Automatic update from web-platform-testsAdd tests for self.queueMicrotask() Follows whatwg/html#2789. -- wpt-commits: 0c3bed38df6d9dcd1441873728fb5c1bb59c92df wpt-pr: 6334 UltraBlame original commit: 141be436c496b0715eac4f3a7c0c6a0c25392a59
…stonly Automatic update from web-platform-testsAdd tests for self.queueMicrotask() Follows whatwg/html#2789. -- wpt-commits: 0c3bed38df6d9dcd1441873728fb5c1bb59c92df wpt-pr: 6334 UltraBlame original commit: 141be436c496b0715eac4f3a7c0c6a0c25392a59
…stonly Automatic update from web-platform-testsAdd tests for self.queueMicrotask() Follows whatwg/html#2789. -- wpt-commits: 0c3bed38df6d9dcd1441873728fb5c1bb59c92df wpt-pr: 6334
Closes #512.
Tests: web-platform-tests/wpt#6334
Chrome is tentatively interested in implementing this, so I'm getting a spec and tests up for review. The actual spec is a one-liner that does what you expect, but I tried to capture some of the discussions from #512 about when this is and isn't appropriate.
Let's continue using #512 for discussion on the merits of this feature, instead of forking the discussion into this PR.
/comms.html ( diff )
/imagebitmap-and-animations.html ( diff )
/index.html ( diff )
/infrastructure.html ( diff )
/references.html ( diff )
/system-state.html ( diff )
/timers-and-user-prompts.html ( diff )
/webappapis.html ( diff )