Skip to content
Taritsyn edited this page Mar 2, 2020 · 48 revisions

JavaScriptEngineSwitcher.Jint contains adapter JintJsEngine (wrapper for the Jint version 3.0.0 Beta 1715).

Engine settings

You can specify a settings of JS engine during its registration:

engineSwitcher.EngineFactories
	.AddJint(new JintSettings
	{
		StrictMode = true
	})
	;

If you manually create an instance of JS engine, then you can pass settings via the constructor:

IJsEngine engine = new JintJsEngine(
	new JintSettings
	{
		StrictMode = true
	}
);

Consider in detail properties of the JintSettings class:

Property name Data type Default value Description
AllowDebuggerStatement Boolean false Flag for whether to allow the debugger statement to be called in a script.
EnableDebugging Boolean false Flag for whether to enable debug mode.
LocalTimeZone TimeZoneInfo TimeZoneInfo.Local Local time zone for the Date objects in the script.
MaxRecursionDepth Int32 -1 Maximum allowed depth of recursion:
  • -1 - recursion without limits;
  • N - one scope function can be called no more than N times.
MaxStatements Int32 0 Maximum number of statements.
MemoryLimit Int64 0 Current memory limit for a engine in bytes.
RegexTimeoutInterval Nullable<TimeSpan> null

Timeout interval for regular expressions.

If the value of this property is null, then the value of regular expression timeout interval are taken from the TimeoutInterval property.

StrictMode Boolean false Flag for whether to allow run the script in strict mode.
TimeoutInterval TimeSpan TimeSpan.Zero Interval to wait before the script execution times out.
Clone this wiki locally