AppsScriptPulse

Apps Script V8: Multiple script files and namespaces – Desktop liberation

Apps Script doesn’t have a module loader system. If you’re used to developing in NodeJs, you’ll also be familiar with importing and exporting to include required modules in your project. With Apps Script, you have no control over the order in which multiple script files are executed. In Legacy Apps Script, there seemed to be some kind of workaround going on so that global statements were executed in a sensible order (I don’t know the details), but in V8 this is not the case. …

My golden rules are

  • Nothing executable should be in global space
  • Don’t rely on the order that things are processed
  • Minimize the number of executable functions (1 is good)
  • Always assume your code will be reused somewhere else.

Source: Apps Script V8: Multiple script files and namespaces – Desktop liberation

Leave a Reply

Your email address will not be published. Required fields are marked *