Define static properties and prototype properties with the class syntax

Rick Waldron waldron.rick at gmail.com
Sat Dec 13 10:24:40 PST 2014


On Sat Dec 13 2014 at 6:04:10 AM Glen Huang <curvedmark at gmail.com> wrote:

> After thinking about it, I think you are right. Defining this defaults
> property is almost like defining a global variable, that modifying it might
> affect lots of objects are created with the constructor.
>
> It’s probably a good thing that class syntax doesn’t support it, but I
> reckon a lot of jquery plugin authors would do “class Foo {}; Foo.defaults
> = {};” nonetheless.
>

I can't speak for all jQuery plugin authors, but in jQuery Core, static
class-side properties (as data and/or functions) are used extensively, eg.
http://api.jquery.com/category/utilities/


Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141213/d2b244da/attachment.html>


More information about the es-discuss mailing list