Re: Strawman Promises consensus position, based on Thursday's telechat

Den 08. okt. 2014 00:23, skrev Martin Thomson:
> On 6 October 2014 23:28, Adam Bergkvist <adam.bergkvist@ericsson.com> wrote:
>> There's one point above that says "navigator.getUserMedia has callbacks".
>> Should this be reflected in the document, and if so, how?
> I believe that navigator.getUserMedia should be defined as being equivalent to:
>
> navigator.getUserMedia = function(constraints, successCallback,
> failureCallback) {
>    let result = navigator.mediaDevices.getUserMedia(constraints);
>    result.then(successCallback, failureCallback);
>    return result;
> }
>
> This removes successCallback and failureCallback from the promise
> chain, but it also ensures that you don't get any weird problems when
> the callbacks return promises, or throw exceptions.
*OK, the difference between this and the original proposal on the thread 
is that you return the promise, which makes the function fall under the 
special rules for promise-returning functions. (or does it? This is 
Javascript, not WebIDL).

So it's subtly different from the pre-Promise specification, but callers 
who throw away the promise won't notice.

What weird behaviours are prevented by this change?

***

Received on Tuesday, 7 October 2014 22:35:57 UTC