Re: Promises in 1.0

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