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

On Fri, Sep 5, 2014 at 10:00 AM, Domenic Denicola <
domenic@domenicdenicola.com> wrote:

> From: Boris Zbarsky [mailto:bzbarsky@mit.edu]
>
> > 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?
>

Currently: nothing.

Rick

Received on Friday, 5 September 2014 16:04:52 UTC