W3C home > Mailing lists > Public > public-media-annotation@w3.org > April 2010

RE: Comments on "API for Media Resource 1.0"

From: Joakim Söderberg <joakim.soderberg@ericsson.com>
Date: Wed, 28 Apr 2010 16:06:03 +0200
To: "public-media-annotation@w3.org" <public-media-annotation@w3.org>
Message-ID: <3D1B26CB887F464CB9F56DEE3D214C9602F07408@ESESSCMS0361.eemea.ericsson.se>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 28 April 2010 14:06:36 GMT