Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!

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

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).

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

FMXExpress.com has over 600 articles with all kinds of tips and tricks for Delphi FireMonkey on Android, IOS, OSX, Windows, and Linux.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.