You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TC39 stage 2 proposal AsyncContext adds new built-in APIs to propagate data through logically-connected sync/async code execution. It will need HTML/Web API integration to properly save and restore context data at the boundary of asynchronous call contexts, e.g. timers, event listeners, and observers.
Define specification infrastructure
...
What solutions exist today?
The solution is not yet complete, submitting this proposal to open a space for discussion in HTML.
How would you solve it?
The issue tc39/proposal-async-context#82 has iterated on various integration points that are essential on the web platform.
The biggest thing we need to decide at the HTML level is, for each API which accepts callbacks, which AsyncContext.Snapshot should it be run in. Many of us are leaning towards "the snapshot where the callback-accepting API was first called".
Some Web APIs could benefit from passing an additional AsyncContext.Shapshot instance to the callback, e.g., it might be useful for window.onerror to have access to the current snapshot when the exception was thrown--this could be an attribute attached to the Event, or the Error/DOMException, for example.
There's an additional proposed API at tc39/proposal-async-context#107 that isn't yet incorporated into that document because there are still some open questions.
As discussed in the last WHATNOT meeting (#11826 (comment)), the AsyncContext web integration will be running through the WHATWG Stages process, since it is large and complicated enough, and the feedback from implementers and spec editors at each step seems very welcome. Currently the way in which this stages process would interact with TC39's is still to be defined.
Activity
littledan commentedon Jun 25, 2024
The biggest thing we need to decide at the HTML level is, for each API which accepts callbacks, which AsyncContext.Snapshot should it be run in. Many of us are leaning towards "the snapshot where the callback-accepting API was first called".
Some Web APIs could benefit from passing an additional AsyncContext.Shapshot instance to the callback, e.g., it might be useful for
window.onerrorto have access to the current snapshot when the exception was thrown--this could be an attribute attached to the Event, or the Error/DOMException, for example.littledan commentedon Jul 24, 2024
Web integration for AsyncContext under discussion at tc39/proposal-async-context#100 .
andreubotella commentedon Jan 14, 2025
The basic web integration document PR has been merged: https://github.com/tc39/proposal-async-context/blob/master/WEB-INTEGRATION.md
There's an additional proposed API at tc39/proposal-async-context#107 that isn't yet incorporated into that document because there are still some open questions.
andreubotella commentedon Nov 3, 2025
As discussed in the last WHATNOT meeting (#11826 (comment)), the AsyncContext web integration will be running through the WHATWG Stages process, since it is large and complicated enough, and the feedback from implementers and spec editors at each step seems very welcome. Currently the way in which this stages process would interact with TC39's is still to be defined.
The AsyncContext web integration is currently stage 0, with the web integration document at the TC39 repo serving as an explainer.
nicolo-ribaudo commentedon Feb 3, 2026
We rewrote the proposed approach for APIs that dispatch events, taking into account some feedback we received. The up-to-date version is at https://github.com/tc39/proposal-async-context/blob/master/WEB-INTEGRATION.md#events.
I would like to discuss it during the whatnot meeting. I'll prepare a couple slides to help the discussion if that's ok.
nicolo-ribaudo commentedon Feb 5, 2026
Slides that I'd like to present (assuming there is enough time for both slides+discussion): https://docs.google.com/presentation/d/1gac4bGDGxatZnffGa0NFKlyVetuMcHvjiIQggXQxF0k/edit
cwilso commentedon Mar 12, 2026
Discussed in 3/5 meeting, so I think this is not agenda+?
nicolo-ribaudo commentedon Mar 12, 2026
yep, not agenda+ anymore
nicolo-ribaudo commentedon Oct 12, 2026
Status update: I submitted #13063 which implements the AsyncContext integration with HTML, with the exception of custom elements.