- From: James M Snell <notifications@github.com>
- Date: Fri, 03 Dec 2021 10:22:44 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 3 December 2021 18:22:57 UTC
Ok, so I just want to summarize where we seem to be landing on this:
1. Add a new `EventTarget.prototype.toPromise(type[, options])` that returns a `Promise` that is resolved with `undefined` when the next event `type` is dispatched.
* `options` will include:
* `signal` - An `AbortSignal` that can be used to cancel waiting for the event `type`.
* The `capture` and `passive` options would have no significant meaning here.
1. Add a new `EventTarget.prototype.toAsyncIterator(type[, options])` that returns an `AsyncIterator` that iterates every time the `type` event is dispatched.
* `options` is the same as `toPromise()`
Using `Promise.race()` should handle the race conditions when there are multiple events that can be expected.
Does this seem correct?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1038#issuecomment-985733476
Received on Friday, 3 December 2021 18:22:57 UTC