by calling load(), will the global variables 'scrollPosition' etc. be freed from memory?
Yes - load() will remove everything from memory and start again. If you were using Bangle.load() with fast load then you might have a problem, but with load() it's fine.
can I break things, if my global variables have names that are used in other apps or the system?
Yes, if they are truly global variables. You can always do:
{
let x = 123;
//...
}
let will put variables in their own scope inside the curly braces.
Will 'require()' load the js file on demand?
Yes
What is the variable scope? The scope of require(), or global?
If it's a module, the scope is in the module, not 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.
Yes -
load()
will remove everything from memory and start again. If you were usingBangle.load()
with fast load then you might have a problem, but withload()
it's fine.Yes, if they are truly global variables. You can always do:
let
will put variables in their own scope inside the curly braces.Yes
If it's a module, the scope is in the module, not global.