Skip to content

Jurassic

dron edited this page Oct 15, 2018 · 13 revisions

JavaScriptEngineSwitcher.Jurassic contains adapter JurassicJsEngine (wrapper for the Jurassic version of February 24, 2018).

Engine settings

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

engineSwitcher.EngineFactories
	.AddJurassic(new JurassicSettings
	{
		StrictMode = true
	})
	;

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

IJsEngine engine = new JurassicJsEngine(
	new JurassicSettings
	{
		StrictMode = true
	}
);

Consider in detail properties of the JurassicSettings class:

Property name Data type Default value Description
EnableDebugging Boolean false Flag for whether to enable script debugging features (allows a generation of debug information). If this is set to true performance and memory usage are negatively impacted.
EnableIlAnalysis Boolean false Flag for whether to disassemble any generated IL and store it in the associated function.
StrictMode Boolean false Flag for whether to allow run the script in strict mode.

Debugging

Jurassic has limited support of the debugging in Visual Studio 2010-2013. You can debug only scripts, that have been executed by using the ExecuteFile method. In addition, debuggable script must contain a debugger statement (see MSDN for more details).

Here are steps, that you need to do for start of debugging:

  1. Switch the solution in debug mode.

  2. Set the EnableDebugging property of the JurassicSettings class to true.

  3. Add the debugger statements in debuggable scripts.

  4. Click on the Start button.

  5. In opened window(s) set breakpoint(s) in the script code.

  6. Click on the Continue button.

    Jurassic script debugging in Visual Studio 2013

See also same topic in the Jurassic documentation.

Known issues

Errors when accessing to the constants of embedded types.

Clone this wiki locally