You could extend the Options class and the setOptions method. The new setOptions will set viariable a to true if b is true and then call the parent setOptions().
On 20 déc, 10:08, stratboy <[email protected]> wrote: > 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?
