Re: [ACTION-43] (sdp related objects and global namespace) - way forward

On 2012-06-18 22:06, Anant Narayanan wrote:
> On 6/18/12 4:51 AM, Harald Alvestrand wrote:
>> On 06/16/2012 06:57 AM, Anant Narayanan wrote:
>>>
>>> const SD = PeerConnection.SessionDescription;
>>> const IC = PeerConnection.ICECandidate;
>>> ...
>>> var foo = new SD();
>>> var bar = new IC();
>
>> 2 questions:
>>
>> 1) Anant, can you write out how this should be specified in WebIDL? It's
>> not obvious to me that it's even possible to write an interface inside
>> another interface.
>
> I think the following is valid:
>
> [NoInterfaceObject]
> [Constructor (...)]

The above is not allowed, but the spec says that a [NamedConstructor] 
extended attribute is OK together with [NoInterfaceObject].

I guess the tricky thing is to only expose the constructor under the 
PeerConnection namespace (and not in the global namespace, which I think 
would happen with [NamedConstructor=Foo] above). Any ideas on how to get 
around that Anant?

/Adam

> interface SessionDescription {
>     ...
> }
>
> interface PeerConnection {
>     attribute Function SessionDescription;
> }
>
> Navigator implements PeerConnection;
>
> Speaking from an implementation point of view, PeerConnection.<object>
> is certainly possible. However, Justin and Adam are correct in that
> there aren't a lot of WebAPIs that do this sort of thing. It still is my
> preferred syntax though :)
>
> -Anant
>

Received on Tuesday, 19 June 2012 11:29:54 UTC