PDA

View Full Version : On Change Variable?



???
07-18-2007, 06:50 PM
Does anyone know how you can get when a variable changes? I was thinking of having a set variable function that called any listeners I attached when it changes a certain var...

Trinithis
07-18-2007, 06:53 PM
Gecko (Mozilla & Firefox) based browsers have something called watch(), which is inherited by all objects. Note that IE and probably most other browser types do not support it.

http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Object:watch

Twey
07-18-2007, 07:09 PM
If you're going for cross-browser support, though, there's nothing to do but poll it.