Re: [whatwg/dom] Proposal: asynchronous event listeners (Issue #1308)

> (But, I don't quite see how waitUntil should help make the initial event dispatch async...)

example code I had in mind:

```js
anything.addEventListener('name', (event) => {
  event.waitUntil(new Promise(async (res, rej) => {
    const thing = await (await fetch(permision)).text();
    if (thing === 'OK') {
      event.stopPropagation();
      event.preventDefault();
      return resolve();
    }
    reject();
  }));
});
```

This idea won't need any execution priority expectation, it would just flag that event as "*unresolved*" until whatever asynchronous thing needed to eventually keep going happens.

I hope this makes sense.

Original proposal + discussion: https://github.com/whatwg/html/issues/9540

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1308#issuecomment-2312895052
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/1308/2312895052@github.com>

Received on Tuesday, 27 August 2024 15:34:50 UTC