Initializing and removing modules
The content of the root module executes every time a module is imported. You can use a root module file to perform initialization steps, for example, initializing a cache, importing static data, or setting a default configuration.
These steps are extra code that you must add to the root module at the beginning or end of the file.
In some cases, it is desirable to execute actions before a module is imported or when a module is removed.
You can use the ScriptsToProcess
property in a module manifest to execute code in the caller scope before a module is imported.
The ScriptsToProcess property
You can use the ScriptsToProcess
property in the module manifest to run scripts in the caller scope before importing the module. The caller is the entity importing the module; if that is an end user in the global scope, then ScriptsToProcess
is executed in the global scope. If the module is imported by another script, ScriptsToProcess
is...