Promises in 1.0

Hi,

I don't fully understand why the whole API has moved from callbacks to
promises just when 1.0 seems close to frozen. Anyhow ok, it's done.

However, how could the JS detect whether the underlying WebRTC stack
in the browser supports callbacks and/or promises?

I mean: I'm pretty sure browsers will accepts callbacks for a while
(by inspecting the number of params given to, for example,
createOffer) but what about if the JS really *wants* to use promises
when available? how to know *when* they are available?


For example, one may suggest something like this:

var p = navigator.getUserMedia(c,s,e);
if (p && p.then) {
  p.then(s).catch(e);
}


...and may be s or e are called twice, depending on how the browser
internally implements the backwards-compatibility stuff.

Any reliable way for this?


-- 
Iñaki Baz Castillo
<ibc@aliax.net>

Received on Tuesday, 7 April 2015 12:21:08 UTC