W3C home > Mailing lists > Public > public-webrtc@w3.org > April 2015

Promises in 1.0

From: Iñaki Baz Castillo <ibc@aliax.net>
Date: Tue, 7 Apr 2015 14:20:15 +0200
Message-ID: <CALiegfmcz3fFUWG2vc6BbUHN__K1ooOTvvQQc0zUD9dPcm1K7g@mail.gmail.com>
To: "public-webrtc@w3.org" <public-webrtc@w3.org>

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) {

...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
Received on Tuesday, 7 April 2015 12:21:08 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 15:19:43 UTC