JsEngineMode enumeration:
* `Auto`. Automatically selects the most modern JavaScript engine from available on the machine.
* `Classic`. Classic MSIE JavaScript engine (supports ECMAScript 3 with possibility of using the ECMAScript 5 Polyfill and the JSON2 library). Requires Internet Explorer 6 or higher on the machine. **Not supported in version for .NET Core.**
* `ChakraActiveScript`. ActiveScript version of Chakra JavaScript engine (supports ECMAScript 5). Requires Internet Explorer 9 or higher on the machine. **Not supported in version for .NET Core.**
* `ChakraIeJsRt`. “IE” JsRT version of Chakra JavaScript engine (supports ECMAScript 5). Requires Internet Explorer 11 or Microsoft Edge Legacy on the machine.
* `ChakraEdgeJsRt`. “Edge” JsRT version of Chakra JavaScript engine (supports ECMAScript 5). Requires Microsoft Edge Legacy on the machine.
The supported .NET types are as follows:
* `MsieJavaScriptEngine.Undefined`
* `System.Boolean`
* `System.Int32`
* `System.Double`
* `System.String`
## Installation
This library can be installed through NuGet - [http://nuget.org/packages/MsieJavaScriptEngine](http://nuget.org/packages/MsieJavaScriptEngine).
## Usage
Consider a simple example of usage of the MSIE JavaScript Engine:
```csharp
using System;
using MsieJavaScriptEngine;
using MsieJavaScriptEngine.Helpers;
namespace MsieJavaScriptEngine.Example.Console
{
class Program
{
static void Main(string[] args)
{
try
{
using (var jsEngine = new MsieJsEngine())
{
const string expression = "7 * 8 - 20";
var result = jsEngine.EvaluateMsieJsEngine class.
Then we evaluate a JavaScript expression by using of the `Evaluate` method and output its result to the console.
In addition, we provide handling of the following exception types: JsEngineLoadException, JsScriptException and JsException.
In the MSIE JavaScript Engine, exceptions have the following hierarchy:
* JsException
* JsEngineException
* JsEngineLoadException
* JsFatalException
* JsScriptException
* JsCompilationException
* JsRuntimeException
* JsInterruptedException
* JsUsageException
Also, when you create an instance of the MsieJsEngine class, then you can pass the JavaScript engine settings via the constructor.
Consider in detail properties of the JsEngineSettings class:
| Property name | Data type | Default value | Description |
|---|---|---|---|
EnableDebugging |
Boolean |
false |
Flag for whether to allow debugging in Visual Studio by adding the debugger statement to script code. |
EngineMode |
JsEngineMode enumeration |
Auto |
JavaScript engine mode. |
MaxStackSize |
Int32 |
503 808 or 1 007 616 |
Maximum stack size in bytes. Set a |
UseEcmaScript5Polyfill |
Boolean |
false |
Flag for whether to use the ECMAScript 5 Polyfill. |
UseJson2Library |
Boolean |
false |
Flag for whether to use the JSON2 library |