Is there a way to have something like setWatch on a variable?
AFAIK, its working for Pins only.
Options comin to my mind are:
There is a way, yes - you can use getters and setters :) Just use Object.defineProperty to create the variable, then add the getter and setter functions that you want... http://www.espruino.com/Reference#l_Object_defineProperty
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem