You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • 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.

About

Avatar for Gordon @Gordon started