Six Easy Ways To Embed JavaScript Engines In Your Delphi 10.2 Tokyo Apps

Posted by on in Blogs

JavaScript is a useful scripting language which you can incorporate within your Delphi 10.2 Tokyo apps in a number of ways. There are open source, commercial component sets, and libraries which quickly allow you to do this in Delphi. These include JSEngine, ScriptGate, paxCompiler, v8delphiwrapper, BESEN, and ChakraCore headers. Some of the reasons why you might want to use Delphi and JavaScript together are for providing end user scripting capabilities, a display layer for your app, or using some great JavaScript libraries within your project.

JSEngine is a commercial component set from Winsoft which provides you access to the Microsoft ChakraCore JavaScript engine. It gives you access to ECMAScript 2015 (ES6) and WebAssembly in Win32 and Win64 apps. There is sample code and demos apps available.

ScriptGate is an open source component that facilities easy access to the JavaScript engine in TWebBrowser on Android, iOS, macOS, and Windows. Developer Andrei Aleksandrov has an article up demoing some code on how to use TScriptGate effectively. Check out the ScriptGate article here. TWebBrowser wraps the native web browser control on each platform so you are going to have a different JavaScript engine on each of those platforms.

paxCompiler is an embeddable cross-platform compiler of the Object Pascal, Basic and JavaScript programming languages. paxCompiler supports Android, iOS, macOS, and Windows. In paxCompiler the JavaScript functionality is more just the ability to use a version of the JavaScript language to execute code within your apps. paxCompiler is a commercial library and component set.

v8delphiwrapper is a Delphi wrapper around the Google Chrome V8 JavaScript engine. The demo that comes with it is for Windows and utilizes the V8 JavaScript engine through a DLL. It looks like V8 implements ECMAScript as specified in ECMA-262. The wrapper itself is open source and it looks like Chrome V8 is open source as well.

BESEN which stands for Bero's Ecma Script Engine is a ECMAScript Fifth Edition implementation and appears to be written entirely in Object Pascal. BESEN looks to be open source as well. It is unclear what platforms are supported but it looks like at least Windows and possibly Linux.

ChakraCore-Samples is a group of headers for Delphi that give you access to ChakraCore plus a demo application that shows you how to use it. This version appears to be open source and probably also only works on Windows as it accesses ChakraCore.dll. As mentioned above ChakraCore is the JavaScript engine from Microsoft.

Lastly, I want to mention the Delphi HTML Component Library which is a cross-patform and 100% native HTML rendering library for Delphi that brings all the power of HTML/CSS into desktop and mobile Delphi applications. The platforms it supports are Win32/64, OSX, Android, iOS and Linux (through FMXLinux).

Gold User, Rank: 89, Points: 5
600+ blog posts about Delphi Firemonkey.


  • Bob Calco
    Bob Calco Tuesday, 14 November 2017

    Just a quick note about paxCompiler, which my company (Apex Data Solutions, LLC) recently acquired. A brand new version is coming out soon - on or before December 1, 2017 - and the product has been re-named Apex Athena. It will support ES5 as an alternative language but JavaScript support in Athena is officially deprecated in favor of a new engine more suitable for dynamic languages like JavaScript, which we call Apex Muse. Apex Muse will support the latest ES6/7 syntax with some enhancements and allow Lua and Clojure(Script) as alternative languages in the same run time. We expect to release the first version of Muse in Q1 of 2018.

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: