and I want to show a scrolling message, I need a timeout for the redraw, and a variable holding the current scroll position.
So I can make a global variable like:
var scrollPosition=0;
var scrollTimeout;
exports.messageListener = function(type, msg) {
}
Now, when I exit this code, by calling load(), will the global variables 'scrollPosition' etc. be freed from memory?
Also, can I break things, if my global variables have names that are used in other apps or the system?
I ask, because this code is in boot.js and thus always loaded. Will 'require()' load the js file on demand? What is the variable scope? The scope of require(), or global?
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.
Thank you.
When I receive a message in
and I want to show a scrolling message, I need a timeout for the redraw, and a variable holding the current scroll position.
So I can make a global variable like:
Now, when I exit this code, by calling load(), will the global variables 'scrollPosition' etc. be freed from memory?
Also, can I break things, if my global variables have names that are used in other apps or the system?
I ask, because this code is in boot.js and thus always loaded. Will 'require()' load the js file on demand? What is the variable scope? The scope of require(), or global?