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

Re: Promises in 1.0

From: Harald Alvestrand <harald@alvestrand.no>
Date: Tue, 07 Apr 2015 15:29:35 +0200
Message-ID: <5523DBBF.1070904@alvestrand.no>
To: public-webrtc@w3.org
Den 07. april 2015 15:01, skrev IƱaki Baz Castillo:
> 2015-04-07 14:58 GMT+02:00 Harald Alvestrand <harald@alvestrand.no>:
>> Just ignore the difference-hiding libraries, and call:
>>
>> thePromise = navigator.mediaDevices.getUserMedia()
>>
>> If this function exists, you have a new browser.
>>
>> The old callback-compatible interface is navigator.getUserMedia.
> 
> Great! But just to be sure: If navigator.mediaDevices.getUserMedia
> exists, does it mean that the whole WebRTC API supports promises?
> 
> 

No, it means that getUserMedia supports promises.

The legacy interface is in section 4.3.3 of the current spec; as with
getUserMedia, the "modern" interface is the only interface where it's
legal to omit the success callback - but unlike with getUserMedia, the
"legacy" interfaces don't live in a separate namespace.

So if you want to check if createOffer() returns a promise, you have to
call createOffer() (no arguments) and see if a promise is returned.

If only callbacks are supported, the call should fail with the WebIDL
equivalent of "wrong number of arguments".
Received on Tuesday, 7 April 2015 13:30:05 UTC

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