Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Creating instances of JS engines

Taritsyn edited this pageApr 1, 2023 ·3 revisions

It is recommended create instances of JS engines by using the following methods of theIJsEngineSwitcher interface:CreateEngine andCreateDefaultEngine.In this case, instances of JS engines are created with the settings, that you specified during their registration.

CreateEngine method

CreateEngine method takes only one parameter - name of JS engine:

IJsEngineengine=JsEngineSwitcher.Current.CreateEngine("ChakraCoreJsEngine");

You can also use constant:

IJsEngineengine=JsEngineSwitcher.Current.CreateEngine(ChakraCoreJsEngine.EngineName);

Since the name of JS engine is a string value, then you can get it from an external source (for example, configuration file).This feature allows you to quickly switch a whole project to usage of the different JS engine.

CreateDefaultEngine method

CreateDefaultEngine method takes no parameters:

IJsEngineengine=JsEngineSwitcher.Current.CreateDefaultEngine();

Decision about which JS engine you need to create depends on the value of theDefaultEngineName property of theIJsEngineSwitcher interface.

Direct creation of instances

You can also directly create instances of JS engines by using constructors:

IJsEngineengine=newChakraCoreJsEngine(newChakraCoreSettings{DisableEval=true,EnableExperimentalFeatures=true});

But choosing this approach, you lose all benefits of the JavaScript Engine Switcher infrastructure.

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp