watch a variable ?

Posted on
  • Is there a way to have something like setWatch on a variable?
    AFAIK, its working for Pins only.
    Options comin to my mind are:

    • extend setWatch function and watcharray handling in jsiIdle
    • use GPIOs which are not wired, sounds crazy, but you never know

  • 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_Obje­ct_defineProperty

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

watch a variable ?

Posted by Avatar for JumJum @JumJum

Actions