I would completely separate this from Options. Options is a very specific thing, which does a very specific thing. One of the important aspects of options is that you can set default options. How would you describe the dependency between A and B? If B should affect A in an automatic fashion, I would create a setB method.
On Mon, Dec 20, 2010 at 11:58 AM, Steve Onnis <[email protected]>wrote: > Well you know the values of the options before you pass them in anyway so i > don't see why you would need to do it within the option parameter...just > pass in the value you want > > Failing that, i would just update the option value within the initialize of > the class > > -----Original Message----- > From: stratboy [mailto:[email protected]] > Sent: Monday, 20 December 2010 8:08 PM > To: MooTools Users > Subject: [Moo] a way to have dynamic class options? > > Hi! I was wandering, is it in some way possible maybe to turn the > options setting dynamic? > > Wait, I tell you better: > > setOptions(). I'd really like the possibility to dinamically change an > option based on another option setting. Suppose this: > > - we have a TestClass with options A and B. > - I can set A true or false, just as I want. > - But If I set B to true, also A should be set to true for the class > to work properly. I would like to automate this process. > > I can place some kind of check in the initialize function, but what if > the option gets changed later? ex. > > var t = new TestClass({ A:false, B:false }); /ok > > but later.. > > t.setOptions({ B:true }); > > //at this time, I'd like a way to intercept the fact that B is changed > and then automatically turn A to true too. //Obviously I don't want to > do it with a timer or things like that. > > Mmm. How would you do it? > > > > > > > > > > > ======= > Email scanned by PC Tools - No viruses or spyware found. > (Email Guard: 7.0.0.21, Virus/Spyware Database: 6.16540) > http://www.pctools.com/ > ======= > > > > > > ======= > Email scanned by PC Tools - No viruses or spyware found. > (Email Guard: 7.0.0.21, Virus/Spyware Database: 6.16540) > http://www.pctools.com/ > ======= > -- Arieh Glazer אריה גלזר 052-5348-561 http://www.arieh.co.il http://www.link-wd.co.il
