The behavior customization for dynamic script evaluation.
Parent Class
Type | Name | Signature |
---|---|---|
constructor | EvalConfig | public EvalConfig() |
method | setReturnException | public void setReturnException(bool) |
method | setShareScope | public void setShareScope(bool) |
method | setUseDefaultRoot | public void setUseDefaultRoot(bool) |
public EvalConfig()
Create a new configuration object with default settings.
public void setReturnException(bool value)
Set whether to return, instead rethrowing, the exception thrown from inside the evaluated script.
By default, if the evaluated script throws, its exception will be propagated back to the callsite. With this set to true
, the exception will be returned as a regular value.
Parameters
public void setShareScope(bool value)
Set whether to share the global scope with the calling script. If true, the changes to global variables will remain in effect after the evaluation finishes, and any new global variables defined in the evaluated script will stay.
This doesn't affect module loading and type definition. All scripts evaluated this way always share the same type system so once an evaluated script introduced new types the following one will always be able to use the without loading again.
Parameters
public void setUseDefaultRoot(bool value)
Set whether to use the default module directory as the root for resolving relative path.
By default, a relative script path will be resolved against the current script's path. However, with this setting one can make it resolve against the default module directory instead. The default module directory refers to jse_modules
directory residing alongside the entrance script.
Parameters
jse_modules
) as the root for resolving relative path; false to use the current script's path (default).