I'm surprised you can't get at global vars within a handler normally - stuff like setWatch/setInterval will set this to be the global object, but just accessing a variable within a function will access the global version if a local one doesn't exist.
As far as callbacks, if you do:
function touch(x,y) {
...
}
require("Touchscreen").connect(touch);
Then you can redefine the touch function, either by just entering it again, or by typing edit("touch").
Shame about the LCD={} stuff. It's a bug in the LCD implementation (normal Espruino doesn't come with the LCD object, so I didn't spot it). I believe I just fixed it, so the next compile from Git should sort it out.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I'm surprised you can't get at global vars within a handler normally - stuff like setWatch/setInterval will set
this
to be the global object, but just accessing a variable within a function will access the global version if a local one doesn't exist.As far as callbacks, if you do:
Then you can redefine the touch function, either by just entering it again, or by typing
edit("touch")
.Shame about the
LCD={}
stuff. It's a bug in the LCD implementation (normal Espruino doesn't come with the LCD object, so I didn't spot it). I believe I just fixed it, so the next compile from Git should sort it out.