2 ms·
I wouldn't really consider this as a "new" pattern, it's been around for as long as I can remember. It's pretty popular in jQuery plugins. I would recommend, h
by nxn 15y ago
I wouldn't really consider this as a "new" pattern, it's been around for as long as I can remember. It's pretty popular in jQuery plugins.
I would recommend, however, against declaring the functions directly on the object you're putting them into. Declare them somewhere else in the closure and just assign them by name on the object you're creating. This way at least the functions are shared instead of being created every time a new object is created.