- DelphiTools - https://www.delphitools.info -

Desktop HTML5 apps game changer? node-webkit

icon-node-webkit-pre-release [1]Recently stumbled upon node-webkit [2], an open-source from  Intel Open Source Technology Center [3], which is deliciously “simple”: combine a standalone webkit [4] (Chromium [5]) build and node.js [6] into a runtime.

Webkit/Chromium brings a high-performance HTML5 environment with JavaScript JITting compiler, WebGL, Audio, hardware accelerated Canvas, camera access, etc.

Node.js brings high-performance access to the local machine resources, so that HTML5 apps can break out of the browser and get access to the file system, databases, server sockets, etc. Just like any other regular application. Check the wiki [7] for more details.

Could it be a game changer?

You get many of the capability of managed frameworks ala .Net / Java with the deployment convenience of a native application.
Node.js asynchronous design means it will just run circles around anything else in a variety of I/O scenarios, and the JavaScript V8 engine can duke it out not just with Java & .Net JITters, but also many native compilers.

Bundling an HTML5 SmartMobileStudio App

wartrail_small [9]I couldn’t resist the temptation to bundle WarTrail [9], my entry to the recent PGD Challenge as a node-webkit app. The node-webkit runtime stands at about 13 MB in an installer, which is a lot lighter than .Net or Java runtimes, and not so heavy compared to some native frameworks I won’t name whose executables start at 8-9 MB.
If you have a lot of resources and data, it becomes a quite acceptable overhead (f.i. media for WarTrail stands at nearly 17 MB compressed, which is light by modern game standards).

You can download the resulting installer [10] (30 MB, built with node-webkit 0.3.4 & InnoSetup [11]). The app app starts instantly and runs at high speed. Memory usage remains quite reasonable given the media resources involved.

For those that want to try it in Linux or OSX, grab the node-webkit precompiled binaries there [2] (scroll down to “Downloads”), the get WarTrail.zip [12] (17 MB), rename it to “WarTrail.nw” (sorry, server doesn’t recognize .nw extension), and feel free to report back on the bundling capabilities of node-webkit on those two systems.

So there you have it, with node-webkit, a SmartPascal [13] app can look like a native app, behave like one, and access resources like one.