Page tree
Skip to end of metadata
Go to start of metadata

This method is used to load a Profound.js module by a Profound.js Program module or a Profound.js Service Program module. Functions from 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

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