This API is used to register a custom API that can optionally have access to the fields collection and the argument names of a Profound.js module from which it is called. To properly register the custom API, the call to profoundjs.registerAPI() should be made within the context of your server's start.js file.
The custom API is attached to the pjs object, which is exposed to every Profound.js module.
- API config - An object with the following properties:
- name - The name of the function to register as an API.
- transform - Pass Boolean true to have Profound.js modify the argument list during the module transformation process.
- addArgNames - Pass Boolean true to include argument names when the argument list is transformed. This property is ignored if "transform" is not also set to true.
- description - a text description of the API
When "transform" is used, the API will receive the following arguments:
- fields collection - An Array representing each scope in the current call stack, with element zero being the most recent calling stack entry. The array has an extra element at the end which represents the global module scope. Each scope array entry contains an Array of Profound.js fields that have been defined by pjs.define() in the given scope.
- control options - An Object containing properties/values that equate to RPG control specifications.
- args - An Array containing the pre-transform arguments passed to the function.
- argNames - An Array containing the name of each pre-transform argument. This argument is only passed if the "argNames" config property is also set to Boolean true.