This method is used to load a Profound.js module and inject the pjs object for use in that module.

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.
  • isProgram - Set to Boolean true if the module should be loaded without exporting additional functions. Only the module's "run" function will be exported.
  • isServiceProgram - Set to Boolean true to export functions from the target module as well as functions from additional modules loaded by the target module.
  • transform - Set to Boolean false if you the module should not be transformed to include Profound.js capabilities. You will not be able to use the pjs namespace or any Profound.js API if this option is set to false.

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.require("mydir/myModule");
myModule.myFunction();