Re: Promise slides

Den 30. sep. 2014 09:14, skrev Jan-Ivar Bruaroey:
> Here are the slides.
>
> .: Jan-Ivar :.
Thank you!

One question on slide 16:

function getUserMedia(constraints, success, failure) {
   var p = navigator.mediaDevices.getUserMedia(constraints);
   p.then(success);
   p.then(failure);
}

The pattern I've seen people use before is p.then(success, failure).
Is this somehow equivalent?
I can't remember having seen what the semantics are of calling p.then 
twice on the same promise - from the ES6 draft you link to:

http://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise.prototype.then

it seems to be stacking handlers on the [[PromiseFulfilReactions]] slot, 
which doesn't make sense to me in this context.

(this feeds into a gripe I personally have with promises - every time I 
try to find the actual spec, I'm lost in a twisty little maze of 
proposals, all subtly different. Thanks for including the link to what 
you think the current spec is!)

         Harald

Received on Tuesday, 30 September 2014 10:39:39 UTC