This doesn't have anything to do with a MooTools design pattern. This is simply a limitation of the JavaScript language. Of course you can call a method with call/apply, it just doesn't act in the way you want it to. In addition MooTools Class even more prevents you from doing this. It is somewhat possible to do it with functions only, but it is not useful either because the created object would not be instanceof the used constructor function.
On Apr 13, 11:48 pm, Aaron Newton <[email protected]> wrote: > Without looking at your code I would say you are fighting too hard. Whatever > you are doing, you're pushing against the MooTools design pattern. I would > reconsider your approach. > > > > On Tue, Apr 13, 2010 at 2:31 PM, אריה גלזר <[email protected]> wrote: > > sadly, this doesn't help me... i am trying to modify Class with a wrapper > > factory (so it could be used as a plugin), and this requires an unknown list > > of parameters... > > ----------- > > אריה גלזר > >052-5348-561 > > 5561 > > > On Tue, Apr 13, 2010 at 22:19, Christoph Pojer > > <[email protected]>wrote: > > >> This is not a MooTools limitation but a JavaScript limitation. You > >> cannot use call or apply on constructor functions. Alternatively you > >> can pass a fixed amount of arguments like > > >> new MyObject(arg, arg1, arg2, ...) > > >> Or create a separate method that sets up your instance with all the > >> necessary functionality like > > >> var obj = new MyObject; > >> obj.setup.apply(obj, arts) > > >> On Apr 7, 1:38 pm, אריה גלזר <[email protected]> wrote: > >> > hey. i want to create a costum factory for a specific Class that > >> requires me > >> > to pass through its mutators before passing them to the Class . the > >> thing > >> > is, Class requires me to use the 'new' operator, which in turn doesn't > >> allow > >> > me to use run/apply etc. so - how can i pass a modified list of > >> paramaters > >> > to an object that requires the use of 'new'? > > >> > hope i'm clear on this... > >> > ----------- > >> > אריה גלזר052-5348-561 > >> > 5561 > > >> -- > >> To unsubscribe, reply using "remove me" as the subject.
