Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Windows 10 uses Chakra to Provide JavaScript For All Applications

Windows 10 uses Chakra to Provide JavaScript For All Applications

Microsoft is expanding the use of its Chakra JavaScript engine in Windows 10, giving developers the ability to use new APIs with their applications.  Named JavaScript Runtime (JSRT) APIs, they originally debuted in Windows 8.1 but focused on server-side functionality.  In Windows 10 these APIs won't be limited to server-side projects and instead can be used in both classic Win32 applications or the Universal Windows Applications.

These APIs are being offered with several additional customization options.  For long-running or frequently used programs, developers can utilize JsSerializeScript to serialize their code prior to execution.  This allows it to be cached and improve startup speed if needed.

Since the inclusion of the JavaScript engine in an application would by design allow users to insert their own code, application developers need ways to limit the resources consumed by these scripts to prevent rogue scripts from causing performance problems.  The JSRT APIs provide the ability to limit these script’s memory and CPU utilization. 

Since Microsoft intends to continuously update their new Edge web browser, they need a way to update its associated Chakra JavaScript engine without disrupting legacy applications that may rely on older features.  Chakra accomplishes this by being split into two versions.  The current (legacy) Chakra engine is contained in jscript9.dll while the new Chakra engine (found in Windows 10) is contained in chakra.dll.  Developers can choose which DLL to target based on their needs.  Machines running Internet Explorer 11 can use apps targeting jscript9.dll providing a separate option for applications that have yet to migrate to Windows 10.

Microsoft summarized the criteria to guide the decision of what library to use as follows:

  • If you need to emphasize backward compatibility of your existing applications, target the legacy engine.
  • If you want your app to be forward looking and support new JavaScript features as they are released (for example, ECMAScript 6), target the Edge engine.

Besides ECMAScript 6 support, targeting the latest DLL will also make for a simplified debugging experience in Visual Studio.  To experiment with the new Chakra and Windows 10, visit Microsoft’s Windows 10 developer tools page.  Some initial Chakra samples are provided on GitHub.

Rate this Article