RE: Comments on "API for Media Resource 1.0"

IN respons to Robins comment #53: "The interfaces aren't clear as to whether they have constructors, in what scope, etc."  

[From Dominique]
In WebIDL, each time an interface is defined (using the interface keyword), that interface is defined in the ECMAScript global scope (i.e.
in general the "window" object), which in most cases you would want to avoid since that "pollutes" the global namespace.

To avoid this, you need to declare the interfaces with the extended attribute [NoInterfaceObject] http://dev.w3.org/2006/webapi/WebIDL/#NoInterfaceObject

But while avoiding globally available constructors is a good thing in general, you still need to provide a way to create objects that match your interfaces, using so-called factory methods that themselves need to belong to an existing or a new object of the global scope; and Robin's comment from what I can tell is asking about how you practically build objects based on the interfaces that are defined.

Pragmatically, I think what needs to be done is to try writing examples of the code would be used for real, and see how the APIs need to be adapted to allow for that type of code. I would strongly suggest starting the document with such a code given as an example, by the way.

Reply: We will provide an example!

/Joakim

Received on Wednesday, 28 April 2010 14:06:36 UTC