-
Notifications
You must be signed in to change notification settings - Fork 49
Node
JavaScriptEngineSwitcher.Node contains adapter NodeJsEngine
(wrapper for the Jering.Javascript.NodeJS version 5.4.0).
This package does not contain the node.exe
. Therefore, you need to install the Node.js and add the node.exe
's directory to the Path
environment variable (automatically done by the official installer).
You can specify a settings of JS engine during its registration:
engineSwitcher.EngineFactories
.AddNode(new NodeSettings
{
TimeoutInterval = TimeSpan.FromMilliseconds(600),
UseBuiltinLibrary = true
})
;
If you manually create an instance of JS engine, then you can pass settings via the constructor:
IJsEngine engine = new NodeJsEngine(
new NodeSettings
{
TimeoutInterval = TimeSpan.FromMilliseconds(600),
UseBuiltinLibrary = true
}
);
Consider in detail properties of the NodeSettings
class:
Property name | Data type | Default value | Description |
---|---|---|---|
TimeoutInterval |
TimeSpan |
TimeSpan.Zero |
Interval to wait before the script execution times out. |
UseBuiltinLibrary |
Boolean |
false |
Flag for whether to use the Node.js built-in library (e.g. |
Since this module is not based on JS engine, but on runtime, then it does not fully comply with requirements of the JavaScript Engine Switcher:
- Not supported
undefined
type. - There is no full support of
null
. - Non-generic versions of the
Evaluate
,CallFunction
andGetVariableValue
methods are not supported. -
EmbedHostObject
andEmbedHostType
methods, that responsible for interop, is also not supported.
- Registration of JS engines
- Creating instances of JS engines
- JS engines
- Upgrade guides
- Additional reading and resources