- From: Michal Mocny <notifications@github.com>
- Date: Tue, 27 Aug 2024 08:23:19 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/1308/2312867094@github.com>
> I wonder if there is an opportunity to integrate the [Prioritized Task Scheduling API](https://wicg.github.io/scheduling-apis/) here. One option would be doing something as simple as passing in a [task priority](https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API#task_priorities) to addEventListener(): I like it! I think this implies that each unique priority would be dispatched as a distinct (macro)task, and that the scheduler could defer lower priority event listeners as needed, perhaps even after rAF. Would all event listeners at the same given priority still be coalesced into the same task? Or, if they are async now anyway, should they all be scheduled as if called with `scheduler.postTask()`? --- > FYI I've proposed to expose event.waitUntil when a listener is asynchronous Interesting! I've made this suggestion before as well, though I wonder if the use case I had in mind was the same as what you suggested? I think that `waitUntil` could be one useful way to express a _lazy-loading controller_ for an event listener. Increasingly frameworks today support lazy-loading controllers/listeners, but rely on synchronous event capture and then later on synthetic event replay, to do so. This is inconvenient and lossy in many ways... though an ideal solution might need to be declarative. (But, I don't quite see how `waitUntil` should help make the initial event dispatch async...) -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/1308#issuecomment-2312867094 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/issues/1308/2312867094@github.com>
Received on Tuesday, 27 August 2024 15:23:23 UTC