Creating Callable Profound.js Modules

 

Profound.js modules are units of code that you can either call directly or call from another module.

A low-code / no-code module is created visually using the Visual Designer tool and saved as a Rich Display File with a .json extension. If you prefer to use code to create your module, it can be written in JavaScript and saved to a file with a .js extension.

The files should be placed within a subdirectory of the modules directory within your Profound.js installation. These subdirectories can represent Workspaces in Profound.js.

When used on IBM i, subdirectories of modules map to IBM i libraries. The pathlist or the IBM i library list searches these subdirectories.

  • In PJS 7.10 onwards, enabling appendPJSpathlist in config.js will append the IBM i library list onto the default PJS pathlist. Modules are then searched starting from the default PJS pathlist before the IBM i library.

When using JavaScript code, in order to create a callable Profound.js module, the JavaScript file you create must export a runable function by specifying the exports.run or export.default property. The following example shows a skeleton for module code. Every runable module must have a similar setup.

mytest.js
function mytest() { // executable code goes here }   exports.default = mytest;

Once a module is created, it can be called one of several ways:

Â