Re: [mediacapture-screen-share] Conditional Focus (When Display-Capture Starts) (#190)

> ```js
> doSomething();  // Maybe ends the task, mabye doesn't.
> ```
Synchronous functions don't end a task, because JS is run to completion. Did you mean `await doSomething()` ?

> The global-attribute API produces code which is hard to reason about. Does it affect `stream1`? Does it affect `stream2`? Both? Neither? If flaky for either - what is the bug? It's definitely not simple.

I claim it is super simple, outside of contrived examples. Here's all users need to know:
 1. Await `navigator.mediaDevices.getUserMedia()`
 2. Set `navigator.mediaDevices.focusPolicy` before you do anything else.

All promise composition is allowed, including shims, `try`/`catch()`, breaking things into async sub-functions, `Promise.resolve(p)` and `Promise.race(p, timeout)`. This I claim is POLA.

If for some reason, you wish to explicitly _not_ affect the just resolved method, then `await new Promise(r => setTimeout(r))`

-- 
GitHub Notification of comment by jan-ivar
Please view or discuss this issue at https://github.com/w3c/mediacapture-screen-share/issues/190#issuecomment-928208512 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 27 September 2021 19:36:16 UTC