Re: Return value of getSupportedConstraints (Re: [Bug 26654] WebIDL types needed in Constrainable application)

On 10 October 2014 10:38, Jan-Ivar Bruaroey <jib@mozilla.com> wrote:
> On 10/10/14, 1:05 PM, Harald Alvestrand wrote:
>>
>> Returning a truthy value requires changing the returned value according
>> to what the type of the constraint is. That's the odd part.
>
>
> All types are ConstrainXxx something so returning this should do:
>
>   { width: {}, height: {}, aspectRatio: {}, frameRate: {}, facingMode: {} };
>
> This is a constant anyway.


That's really odd.  What's wrong with { width: true, height: true,
aspectRatio: true, ...} other than the fact that
MediaStreamTrackConstraintSet (or whatever it's called) doesn't permit
that syntax?  Is this just an attempt to avoid creating a new,
parallel structure?

It's possible to use a named properties structure here, isn't it?
http://www.w3.org/TR/WebIDL/#idl-named-properties

interface ConstraintSetSupports {
  getter boolean (DOMString constraintName);
};

With the set of names being defined in text.  This would have the
advantage of being extensible.

Received on Friday, 10 October 2014 18:25:01 UTC