EvalConfig CLASS

The behavior customization for dynamic script evaluation.

Parent Class

All Members


TypeNameSignature
constructorEvalConfigpublic EvalConfig()
methodsetReturnExceptionpublic void setReturnException(bool)
methodsetShareScopepublic void setShareScope(bool)
methodsetUseDefaultRootpublic void setUseDefaultRoot(bool)

Constructors


public EvalConfig()

Create a new configuration object with default settings.


Methods


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

  • value True to return any thrown exception as the result; false to rethrow the exception (default).

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

  • value True to share; false to not share (default).

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

  • value True to use default module directory (jse_modules) as the root for resolving relative path; false to use the current script's path (default).