Oops typo! There isn't any real gains from defining the prototype like I did, I was doing it to show how you can define a "class" in a way similar to mootools. However compared to your example it offers memory and initialization improvements. With your example every time I initialize a new class I have to make a copy of the methods. Using the prototype you only have one copy for all initialized classes. This is the way mootools does it internally.
Not saying that you have to break away. There is still a lot of motion in mootools... its just moving into smaller pieces like prime. If you really like the class system... You should checkout https://npmjs.org/package/Classy On Mon, Aug 12, 2013 at 3:49 PM, utan <vcomputado...@gmail.com> wrote: > Your example it's very similar to mine, thought I don't use the prototype > I know supposedly won't duplicate method at every instance of the class.. > I am learn more raw Js that's the way to go so I don't a brick wall > again..But I am sticking with creation of object as I put the example since > it feels > more natural to me.. > > Now you created the class object and added the method in the prototype > later, now that's something never seen, this ways will yield more > performance? > > is this a typo? > > function MyClass = function(options){ > this.options = merge(defaults, options); > } > you used the keyword function at the beginning and also latter.. > > > -- > > --- > You received this message because you are subscribed to the Google Groups > "MooTools Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to mootools-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- --- You received this message because you are subscribed to the Google Groups "MooTools Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to mootools-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.