Node -Webkit vs Electron

We plan to create a cross-platform desktop application. We found that Node-Webkit is a great choice for us. But GitHub developed its own infrastructure called Electron instead of using Node-Webkit.

What is the difference between the two?

+47
electron node-webkit
May 7 '14 at 5:22
source share
1 answer

Electron has a page explaining the differences with node-webkit:

https://github.com/atom/electron/blob/master/docs/development/atom-shell-vs-node-webkit.md

Like node-webkit, Electron provides a platform for writing desktop applications with JavaScript and HTML, and has Node integration to provide access to a low-level system on web pages.

But there are also fundamental differences between the two projects, which makes Electron a completely separate product from node-Webkit:

1 - Enter application

In NW.js, the main entry point for the application is a web page or JS script. You specify the html or js file in package.json and it opens in the browser window as the main application window (in the case of the html entry point) or the script is executed.

In the Electron element, the entry point is a JavaScript script, instead of a direct URL, you need to manually create a browser window and load the html file into it with the corresponding API. You should also listen to window events to decide when to exit the application.

So, Electron works more than at Node.js runtime, and the API is lower. level, you can also use Electron for web testing purposes like phantomjs,

2 - System assembly

To avoid the complexity of building all the chrome, Electron uses libchromiumcontent to access the Xromium Content API, libchromiumcontent is a separate shared library that includes Chromium Content and all its dependencies. Therefore, users do not need a powerful machine for assembling the atomic shell.

3 - Node integration

In node-webkit, the integration of Node on web pages requires the Chrome fix to work, while in Electron we chose a different way to integrate the libuv loop in each platform message loop to avoid Chromium breaking, see the node_bindings code for how this was done .

4 - Multicontext

If you are an experienced node-webkit user, you should be familiar with the concept of Node context and network context, these concepts were invented due to how node-webkit was implemented.

Using the Node multi-contact function, Electron does not introduce a new JavaScript context on web pages.

Source Code Protection

Electron packs its applications using asar , which contains the insecure source code of applications. This allows application 1 to retrieve application 2 and inject vulnerable scripts without knowing it. You can check this project on GitHub to see an example of how to manage the Slack application for an example. At the moment , the Electron team does not plan to implement source code protection support .

NW.js has built-in support for compiling source code into protected binary files .

+60
May 7 '14 at 7:43
source share



All Articles