pjs.transferControl()
Â
This API transfers control to another Profound.js module. This is similar to calling a module, except the caller is removed from the call stack before the call is made. Therefore, when the called program exits, control is not returned to the caller. Instead, the previous call stack entry takes over.
Parameters
(String) Porfound.js module name.
(Variable, optional) - One or more parameters.
Profound.js transfers control by throwing a special exception that is monitored by the Profound.js framework. If you are using a custom try/catch block around the pjs.transferControl() API call, you should re-throw the exception. For example:
try/catch with pjs.transferControl()
try {
pjs.wrap(fs.readFile, fs)(filePath); // Could throw!
pjs.transferControl("myprogram");
}
catch (error) {​
if (error instanceof pjs.TransferControlException) throw error;
else doSomethingElse();
}​
Â