hi ...
so x is a simple js-variable and you want to react with 'somefunction' when the value of x changes?
but i assume you already know WHERE x changes (in case its your own code)? ... everytime a value is assigned to x you may call 'somefunction' or use a set-function for x instead of a simple assignment ... and in that so called 'setter' you may call whatever you want ...
hope i didn't misunderstood your problem?
another method would be to define a watcher:
- obj.watch(property, callback);
-
and to detach the watcher:
kind regards
tnx for the idea...
I have tried out the way u suggested ... it works fine...
But my doubt is...
we write:
- http.onreadystatechange=response;
response is triggered whenever onreadystatechange is chnged from 0 .. 4.
similarly... i write
- function base() {
-
this.x=0;
-
}
-
-
base = new base()
-
-
function tst(){
-
base.x = callfun;
-
}
in a html page i have 2 buttons
on a 1st onclick event i say base.x=1// I need callfun to be triggered (coz x has changed)
on a 2nd onclick event i say base.x=2// I need callfun to be triggered (coz x has changed)
Is This possible...?
Looking for ward fir a reply..
Thanks in advance