Skip to content

Modules

Adding Modules

Erizos Studio UI Builder supports creating Modules that help with organizing and structuring the code of the user interface, allowing developers to separate code into different modules, just as you would separate code into separate files, helping to create modularity and maintainability within the code. All UIs in Erizos Studio have one main module named "Script". Developers are able to create additional Modules based on their needs.

Create Module

To add a module to a UI:

  1. Click the Stacked Box icon
  2. Under Modules,click the Create Module Icon .
  3. Name your Module and click Save

To access a module function or variable, users need to export the functions or variables to be exposed. to do this, users need to add export as shown in the example below:

1
2
3
export const MyModuleFunction = () => {
  console.log("Hello, I am a Module Function")
}

Accessing Modules

The function of a module can be accessed from other modules via the module name, for example:

MyModule.MyModuleFunction() // where MyModule is the name of the Module and MyModuleFunction is the name of the function