RE: [webidl] Defining constructors on non-global objects?

From: Boris Zbarsky [] 

> If this is the API you want, then for the moment you can define an AmbientLight factory method that returns an object of the right type, and the "new" call above will work due to how "new" works in JS.  But the returned object won't be instanceof Sensor.AmbientLight, and won't have Sensor.AmbientLight as its .constructor

I think it would be better not to do that. The approach I would take is, make up a fictitious syntax for now (we can brainstorm on that if you'd like) and we will be sure to get it into WebIDL before your spec needs to ship.

Because I am passionate about not letting WebIDL restrict good design, I personally will volunteer to do the work of speccing this for you. Although that will be dependent on implementer consensus, as such a change to IDL's capabilities would need to be reflected in their code generators... :-/

That said, what does the Sensor constructor do by itself?

Received on Friday, 5 September 2014 14:01:09 UTC