- From: Jan-Ivar Bruaroey via GitHub <sysbot+gh@w3.org>
 - Date: Sat, 03 Sep 2022 00:55:18 +0000
 - To: public-webrtc-logs@w3.org
 
Callbacks are ugly, and tasks and microtasks are equally vulnerable to busy waiting. So I'd prefer e.g.:
```js
function queueTask(f) {
  window.addEventListener("message", f, {once: true});
  window.postMessage("hi", window.origin);
}
const controller = new CaptureController();
const stream = await navigator.mediaDevices.getDisplayMedia({controller});
controller.focus(); // works
await undefined;
controller.focus(); // works
await new Promise(queueTask);
controller.focus(); // throws
```
If the next task takes over a second to run then something's seriously broken and focus fails, which seems good. Thoughts?
-- 
GitHub Notification of comment by jan-ivar
Please view or discuss this issue at https://github.com/w3c/mediacapture-screen-share/issues/230#issuecomment-1236009059 using your GitHub account
-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Saturday, 3 September 2022 00:55:20 UTC