What you need to know about JavaScript Engine Switcher 3.0

What you need to know about JavaScript Engine Switcher 3.0

JavaScript Engine Switcher was originally created as a helper library and its development was largely determined by the needs of the libraries that used it. In fact, each of its major versions solved one or several major problems necessary for the further development of other libraries:

  • In the first version, this task was to add as many adapter modules as possible for popular JS engines that support the .NET platform. And this gave Bundle Transformer users a certain amount of flexibility: on developer computers, they could use the MSIE module, which supports debugging JS code using Visual Studio, and on servers that did not have a modern version of Internet Explorer or did not have it installed at all, they could use module V8. Some have even managed to run Bundle Transformer in Mono on Linux and Mac using the Jurassic and Jint modules.
  • The main goal of the second version was to implement .NET Core support, which was required for the new version of the ReactJS.NET library. Another important task was to create a cross-platform module capable of quickly processing large amounts of JS code (the Jurassic and Jint modules were not suitable for this), and after a number of improvements, the ChakraCore module became such a module.
  • In the third version, the main focus was on improving integration with the ReactJS.NET library and increasing performance.

In this article, we will look at some of the innovations of the third version, which for many turned out to be unclear even after reading the release text and the documentation section “How to upgrade applications to version 3.X”: changes in the JsEngineSwitcher class, refactoring of exceptions, more informative error messages, interruption and pre-compilation of scripts, the ability to change the maximum stack size in the ChakraCore and MSIE modules, as well as a new module based on NiL.JS.

Changes to the JsEngineSwitcher class

In the new version, the JsEngineSwitcher class implements the IJsEngineSwitcher interface and is no longer a singleton (it can be instantiated using the new operator). To get a global instance, use the Current property instead of the Instance property. The Current property, unlike the deprecated Instance property, has a return type of IJsEngineSwitcher.

What are the prospects for the "unfashionable" .NET platform - expert opinions

What are the prospects for the “unfashionable” .NET platform – expert opinions

The rise and fall of Visual Basic

The rise and fall of Visual Basic