Skip to content

TC39 AsyncContext Integration #10432

Open

Description

@legendecas

What problem are you trying to solve?

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.

Activity

  1. littledan commented on Jun 25, 2024

    @littledan
    Contributor

    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.

  2. littledan commented on Jul 24, 2024

    @littledan
    Contributor

    Web integration for AsyncContext under discussion at tc39/proposal-async-context#100 .

  3. andreubotella commented on Jan 14, 2025

    @andreubotella
    Member

    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.

  4. removed
    agenda+To be discussed at a triage meeting
    on Jan 16, 2025
  5. andreubotella commented on Nov 3, 2025

    @andreubotella
    Member

    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.

  6. added and removed
    agenda+To be discussed at a triage meeting
    on Nov 13, 2025
  7. nicolo-ribaudo commented on Feb 3, 2026

    @nicolo-ribaudo
    Member

    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.

  8. nicolo-ribaudo commented on Feb 5, 2026

    @nicolo-ribaudo
    Member

    Slides that I'd like to present (assuming there is enough time for both slides+discussion): https://docs.google.com/presentation/d/1gac4bGDGxatZnffGa0NFKlyVetuMcHvjiIQggXQxF0k/edit

  9. added
    agenda+To be discussed at a triage meeting
    and removed
    agenda+To be discussed at a triage meeting
    on Feb 10, 2026
  10. cwilso commented on Mar 12, 2026

    @cwilso
    Contributor

    Discussed in 3/5 meeting, so I think this is not agenda+?

  11. removed
    agenda+To be discussed at a triage meeting
    on Mar 12, 2026
  12. nicolo-ribaudo commented on Mar 12, 2026

    @nicolo-ribaudo
    Member

    yep, not agenda+ anymore

  13. nicolo-ribaudo commented on Oct 12, 2026

    @nicolo-ribaudo
    Member

    Status update: I submitted #13063 which implements the AsyncContext integration with HTML, with the exception of custom elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposalNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express intereststage: 1Incubation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions