- From: jan-ivar via GitHub <sysbot+gh@w3.org>
- Date: Wed, 14 Jun 2017 19:35:14 +0000
- To: public-media-capture@w3.org
jan-ivar has just created a new issue for https://github.com/w3c/mediacapture-image:
== Async methods' "in parallel" steps need help. ==
The pattern used by the async methods under [3.2 Methods](https://w3c.github.io/mediacapture-image/#imagecapture-methods) is wrong: When invoked:
1. Check state and return rejected promise if wrong.
2. Queue a task, using the **DOM manipulation task source**, that runs the following steps in parallel:
1. Manipulate media tracks.
2. **Return a promise** resolved with some value.
The promise must be returned *immediately* from the function, not in a queued task where it's ignored.
Also the *DOM manipulation task source* doesn't run in parallel. It's the main thread we're already on. We don't want to do media operations on the main thread.
We should instead follow the [promise guide](https://www.w3.org/2001/tag/doc/promises-guide#explicit-async-steps) and use: When invoked:
1. Check state and return rejected promise if wrong.
2. Let *p* be a new promise.
2. Run the following steps in parallel:
1. Manipulate media tracks.
2. Resolve *p* with some value.
3. Return *p*.
Where [Resolve *p*](https://www.w3.org/2001/tag/doc/promises-guide#shorthand-manipulating) is accepted shorthand for "queue a task back to the main thread to resolve p".
Please view or discuss this issue at https://github.com/w3c/mediacapture-image/issues/184 using your GitHub account
Received on Wednesday, 14 June 2017 19:35:20 UTC