No, is not quite the same, If you look at the first version of my gist here: https://gist.github.com/299387/bc1f3286c7e695b38786b8aa8d94224c11d48113 you will see that to apply for a mootools class, you must using new on the class, without initialize, because if you define properties, these must be loaded before initialize, than after calling new on the class without initialize, you can apply the initialize passing the object you created masking the initialize...
it works, but after talking with the mootools dev I found another simpler way, using Class.instantiate and then applying for initialize like in this gist: https://gist.github.com/299387/1cf26bf83a0a351e70c63e7044276857572a5e23 @Sanford: I used my approach in my IOC container : http://gist.github.com/299395 as you see, I never call new, because I use Class.Istantiate, If you're asking me if istanceof will work, yes, it works :) On 18 Apr, 13:01, אריה גלזר <[email protected]> wrote: > Found it! calling apply with the function's prototype ( > Class.apply(Class.prototype,[...]) ) is the same as calling new. > > hope i'm not embarrassing myself, but the main difference between calling a > function and using 'new' (at least the way i understand it) is the object ' > this' points to.http://www.jsfiddle.net/c2dtW/ > > This way we can create costum factories to any Function\Object\Class we > like. > > ----------- > אריה גלזר > 052-5348-561 > 5561 > > On Thu, Apr 15, 2010 at 21:34, Sanford Whiteman <[email protected] > > > > > wrote: > > > I think you wanna look at this gist ;) > > > >http://gist.github.com/299387 > > > Can you put up a demo of using operator new + opaque arguments object > > + returning an instanceof Class using your approach? > > > -- S. > > > -- > > To unsubscribe, reply using "remove me" as the subject.
