Node.js + Chromium = AppJS: one of the promising options for the second step in the evolution of the web developer

    Now we will talk a little bit about how the recent emergence of a new tool and related opportunities opens up the possibility for modern web developers to evolve quickly, move to new levels, acquire new professional skills, and develop new areas of creative work. Such a tool is Node.js and its growing infrastructure. The first step in the evolution of a web developer takes place when a developer gets acquainted with Node.js and immediately realizes that he now only needs to use the knowledge of javascript and learn a fairly simple API

    Node, to immediately get the opportunity to compose not only scripts for sites, but also console applications, and even server (in particular, web server).

    Historically, this is not the first of such tools.
    Each of us can recall that before Node.js there were attempts to create an engine for convenient programming in javascript ( Windows Script Host , Rhino , JSDB , and so on).

    However, only at Node we see a fairly fast engine (V8), and cross-platform, and a simple API, and a great many additional modules . The combination of these advantages makes Node successful and convenient.

    The second step in the evolution of a web developer occurs when knowledge of the JavaScript language (as well as other web technologies - primarily CSS and HTML or XML) can be used to develop applications with a graphical user interface - that is, with a GUI.

    Many manufacturers have created web-like GUI application development tools.
    Here you can recall a dozen more or less successful attempts to achieve the desired.

    The Mozilla Foundation first came up with XUL and XULRunner , and then the whole operating system - Firefox OS .

    Hewlett-Packard has released webOS (more recently, Open webOS ).

    Google invented Google Chrome OS .

    You may also recall that Qt has a JavaScript-based GUI markup language - QML is called.

    Develop the PhoneGap , Appcelerator Titanium , as Adobe the AIR and other tools vebopodobnogo software cross-platform applications.

    Some of the above solutions were born weighty (for example, when a large virtual machine or even a new operating system is required to run a web-like application). Most of them will also require the programmer to learn some API, sometimes quite clumsy and scary (for example, XPCOM for XULRunner), but even when such an API is elegant enough, it still takes effort to study it. The more he knows how, the more extensive the API will be.

    Meanwhile, if at the first step of his evolution the web developer managed to learn the API from Node.js - is there no way to rely on this knowledge and not learn anything further in the future?

    The second step in the evolution of the web developer becomes a natural continuation of the first if the layout and layout of the web-like application is set using HTML and CSS, and the behavior is set using JavaScript, and the well-known Node.js engine works under the hood .

    In particular, if we use AppJS , then the object model (DOM) of the displayed “page” contains the global Node.js object under the name window.node , and we can easily read the version of Node in window.node.process.versions.node , in window.node.process.arch - processor architecture, in window.node.process.platform -platform, and display some such message in the window of our graphical application:


    (It is clear that other Node.js features can be used in the same way - network, file, and so on.)

    What is AppJS?

    AppJS is the Node engine, to which, as one of its modules, the WebKit engine from the Google Chrome browser, or rather, from its free version, Chromium, is attached. Currently Chromium is used in the form of CEF (Chromium Embedded Framework), about which enough has told us Dima_Sharihin , when he spoke of Chromium connect to .NET.As you can see, CEF can be fastened not only to, but also to javascript, which the creators of AppJS managed to do.

    Currently, the AppJS project is at the very beginning of its development and has not even reached version 0.1 - the demo builds available on Github are 0.0.19. There is no documentation except code examples; You can, however, to some extent familiar with AppJS capabilities even now, if you download a demo assembly (containing a kind of “hello world”) from your github under your operating system, run it, read the source code and comments on it, make changes and see what it turns out.

    In this assembly, under the name " data / app.js "the file containing the settings of the main application window is located. When a window is created, it is loaded Page « data / content / the index.html », which may apply to window.node and reach the Node engine.

    The AppJS application window has many of the qualities of the Chromium browser, although it lacks a toolbar, status bar, and other elements of the browser interface. In particular, you can press Alt + F12 and get a debug console.

    AppJS launches the Node engine with the key “--harmony”, so the application has all the ECMAScript Harmony features available in V8.

    Having seen such a promising project, I did not, of course, wait for its development to version 0.1 - before that, perhaps, there are still many weeks and months left - and I hastened to acquaint the readers of Habrahabr as soon as possible with it.

    P.S. AppJS is not the only project aimed at creating web - like GUI applications using the JavaScript language and the Node engine. Perhaps in the future I will talk about Habrahabr and other similar projects.

    Postscript. And he talked about node-webkit - a project that looks even more promising than AppJS.

    Also popular now: