pjs.requireServiceProgram()

 

This method is used to load a Profound.js module as a Service Program. When loaded this way, functions from the target module as well as functions from additional modules loaded by the target module will be exported.

Parameters

1. Module path / name - A String containing the module file name to load. Optionally, an absolute path or path relative to the 'modules' directory can be used. If only the file name is given, the pathlist will be searched to locate the module. If the file extension is omitted, ".js" is assumed.

2. Options (optional) - An object with the following properties:

  • hotReload - Set to Boolean false if the module should not be reloaded when the file has changed and only loaded once once for the duration of the Profound.js process. This setting overrides the global hotReloading setting.

Exception Handling

An Error will be thrown if there are any problems loading the module, such as a file not found or syntax error.

Example

exports.activationGroup = "Named1";   var mySrvpgm = pjs.requireServiceProgram("mydir/mySrvpgm");   // Exported functions can be called like this: mySrvpgm.myFunction(); // Exported functions are also attached to the scope from which pjs.requireServiceProgram() is called. // Therefore, calling functions directly as follows is also valid: myFunction();

 

mydir/mySrvpgm.js
exports.activationGroup = "Named1";   pjs.requireModule("module1"); pjs.requireModule("module2"); pjs.requireModule("module3");