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

Re: Promises in 1.0

From: <piranna@gmail.com>
Date: Tue, 7 Apr 2015 14:30:42 +0200
Message-ID: <CAKfGGh3TB1u-wHcb4O547TPBQCjrdYet7LV8u8nx5mrFwe1L1g@mail.gmail.com>
To: Iñaki Baz Castillo <ibc@aliax.net>
Cc: "public-webrtc@w3.org" <public-webrtc@w3.org>
I've develop a function that set a Node.js callback on a Promise,
maybe they would implement internally something similar (Promises
first, callbacks as alternative):

https://github.com/piranna/promisecallback

2015-04-07 14:20 GMT+02:00 Iñaki Baz Castillo <ibc@aliax.net>:
> 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>
>



-- 
"Si quieres viajar alrededor del mundo y ser invitado a hablar en un
monton de sitios diferentes, simplemente escribe un sistema operativo
Unix."
– Linus Tordvals, creador del sistema operativo Linux
Received on Tuesday, 7 April 2015 12:31:35 UTC

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