This seems to be set to... an object containing everything. How do I get it to be the object that the function is a property of?
Secondly - with same code, try doing:
evr.onWatch=function(){console.log("roar!!!");} //where evr is an instance of that object
then provoke another serial data event. The callback isn't updated. How can I make it call the function I pointed it at, instead of remembering what said function happened to be when I initially set up the callback? Is this behavior intended?
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.
How do I make
this
work here?This seems to be set to... an object containing everything. How do I get it to be the object that the function is a property of?
Secondly - with same code, try doing:
evr.onWatch=function(){console.log("roar!!!");} //where evr is an instance of that object
then provoke another serial data event. The callback isn't updated. How can I make it call the function I pointed it at, instead of remembering what said function happened to be when I initially set up the callback? Is this behavior intended?
Thanks