Scripting Integrator - Online Help
Scripting Integrator
Questions / Feedback?

JavaScript Component

Properties   Methods   Events   Configuration Settings   Errors  

The JavaScript component allows quick and simple evaluation of JavaScript source code.

Syntax

nsoftware.InScript.Javascript

Remarks

The JavaScript component allows quick and simple evaluation of JavaScript source code. JavaScript code can be evaluated from a file or simply from a string that holds valid JavaScript.

Prior to calling Eval or EvalFile any custom functions must be added by calling AddFunction. At the time of execution when the function is called the Function event will fire. Within this event the Parameters property may be queried to obtain information about the function parameters. Calculate the and provide the return value within Function.

The AddVariable method may also be used to add a variable to the running context.

To execute the JavaScript code call Eval or EvalFile. The output is returned by these methods. If any errors occur during processing the Error event will fire.

The component relies on an external engine to execute the JavaScript code. Several common engines are shipped with the toolkit. The Engine property specifies which engine will be used.

Engine Notes

The component uses a common interface which acts as a bridge between the component itself and the actual engine. The component will make calls to the interface library which will in turn make calls to the selected engine. Every project must include the interface library, as well as the selected engine library.

The interface library is a separate file: "nsoftware.InScript.Interface.dll" (.NET) or "inscript.interface.jar" (Java). This file must be included in your project.

In addition to the interface library, the actual engine must be present. Several engine libraries are shipped with the product in the "lib" folder. The engines do not need to be included in your project, but must be present at runtime in order to be loaded by the interface library.

Windows Engines

The component supports two different JavaScript engines: The V8 JavaScript engine from Google and the Jurassic engine. Possible values for this property are:

  • jurassicengine.dll (.NET Edition Only)
  • v8engine.dll (default)
If the V8 JavaScript engine is used the two dlls "v8engine.ia32.dll" and "v8engine.x64.dll" are also relevant. The v8engine.dll is a managed library which will call the appropriate native library (v8engine.ia32.dll or v8engine.x64.dll). The application's target architecture determines which native dll will be needed at runtime. When distributing an application, both "v8engine.dll" and "v8engine.ia32.dll" or "v8engine.x64.dll" should be deployed as well. It is safe to deploy both "v8engine.ia32.dll" and "v8engine.x64.dll". The appropriate native library will be loaded at runtime.

Java Engines

The component supports the Rhino JavaScript engine. Possible values for this property are:

  • rhinoengine.jar (default)

Eval Notes

When calling Eval or EvalFile any custom functions must first be defined by calling AddFunction. When the function is encountered the Function event will fire. Within this event query the Parameters collection to get the function parameter values. The return value of the custom function is defined within the Function event.

Any errors such as undefined functions or other issue will cause the Error event. Errors will not cause an exception. It is important to monitor the Error event for information about any errors that occur.

The return value from Eval or EvalFile is the output from successful execution of the JavaScript.

Property List


The following is the full list of the properties of the component with short descriptions. Click on the links for further details.

EngineIndicates the active JavaScript engine.
EvalFrameIndicates the current frame of the JavaScript source code.
ParametersA collection of function parameters when custom function is invoked.

Method List


The following is the full list of the methods of the component with short descriptions. Click on the links for further details.

AddFunctionAdds a custom function.
AddVariableAdds a variable to running context.
CloseCloses the JavaScript context.
ConfigSets or retrieves a configuration setting .
EvalExecutes the specified JavaScript source code.
EvalFileExecutes the specified JavaScript source file.
GCPerforms garbage collection.
InterruptTerminates the running JavaScript execution.

Event List


The following is the full list of the events fired by the component with short descriptions. Click on the links for further details.

ErrorInformation about errors during data delivery.
FunctionFired when a custom function is called.

Configuration Settings


The following is a list of configuration settings for the component with short descriptions. Click on the links for further details.

EngineNameThe name of internal JavaScript engine.
EngineVersionThe version of internal JavaScript engine.
CodePageThe system code page used for Unicode to Multibyte translations.

 
 
Copyright (c) 2017 /n software inc. - All rights reserved.
Build 1.0.6240.0