Skip to content

Commit b4447be

Browse files
felixriesebergckerrmalept
authored
docs: Update the "Electron vs NW.js" document (electron#22836)
* docs: Update the "Electron vs NW.js" document * Update docs/development/electron-vs-nwjs.md Co-Authored-By: Charles Kerr <ckerr@github.com> * Update docs/development/electron-vs-nwjs.md Co-Authored-By: Mark Lee <malept@users.noreply.github.com> * Update docs/development/electron-vs-nwjs.md Co-Authored-By: Mark Lee <malept@users.noreply.github.com> Co-authored-by: Charles Kerr <ckerr@github.com> Co-authored-by: Mark Lee <malept@users.noreply.github.com>
1 parent 6bf83e9 commit b4447be

File tree

2 files changed

+75
-52
lines changed

2 files changed

+75
-52
lines changed

docs/development/atom-shell-vs-node-webkit.md

Lines changed: 0 additions & 52 deletions
This file was deleted.

docs/development/electron-vs-nwjs.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Technical Differences Between Electron and NW.js
2+
3+
Like [NW.js][nwjs], Electron provides a platform to write desktop applications with web
4+
technologies. Both platforms enable developers to utilize HTML, JavaScript, and
5+
Node.js. On the surface, they seem very similar.
6+
7+
There are however fundamental differences between the two projects that make
8+
Electron a completely separate product from NW.js.
9+
10+
## 1) Entry of Application
11+
12+
In NW.js, the main entry point of an application can be an HTML web page. In
13+
that case, NW.js will open the given entry point in a browser window.
14+
15+
In Electron, the entry point is always a JavaScript script. Instead of providing a
16+
URL directly, you manually create a browser window and load an HTML file using
17+
the API. You also need to listen to window events to decide when to quit the
18+
application.
19+
20+
Electron works more like the Node.js runtime. Electron's APIs are lower level so
21+
you can use it for browser testing in place of
22+
[PhantomJS](http://phantomjs.org/).
23+
24+
## 2) Node Integration
25+
26+
In NW.js, the Node integration in web pages requires patching Chromium to work,
27+
while in Electron we chose a different way to integrate the `libuv` loop with
28+
each platform's message loop to avoid hacking Chromium. See the
29+
[`node_bindings`][node-bindings] code for how that was done.
30+
31+
## 3) JavaScript Contexts
32+
33+
If you are an experienced NW.js user, you should be familiar with the concept of
34+
Node context and web context. These concepts were invented because of how NW.js
35+
was implemented.
36+
37+
By using the
38+
[multi-context](https://github.com/nodejs/node-v0.x-archive/commit/756b622)
39+
feature of Node, Electron doesn't introduce a new JavaScript context in web
40+
pages.
41+
42+
Note: NW.js has optionally supported multi-context since 0.13.
43+
44+
## 4) Legacy Support
45+
46+
NW.js still offers a "legacy release" that supports Windows XP. It doesn't
47+
receive security updates.
48+
49+
Given that hardware manufacturers, Microsoft, Chromium, and Node.js haven't
50+
released even critical security updates for that system, we have to warn you
51+
that using Windows XP is wildly insecure and outright irresponsible.
52+
53+
However, we understand that requirements outside our wildest imagination may
54+
exist, so if you're looking for something like Electron that runs on Windows XP,
55+
the NW.js legacy release might be the right fit for you.
56+
57+
## 5) Features
58+
59+
There are numerous differences in the amount of supported features. Electron has
60+
a bigger community, more production apps using it, and [a large amount of
61+
userland modules available on npm][electron-modules].
62+
63+
As an example, Electron has built-in support for automatic updates and countless
64+
tools that make the creation of installers easier. As an example in favor of
65+
NW.js, NW.js supports more `Chrome.*` APIs for the development of Chrome Apps.
66+
67+
Naturally, we believe that Electron is the better platform for polished
68+
production applications built with web technologies (like Visual Studio Code,
69+
Slack, or Facebook Messenger); however, we want to be fair to our web technology
70+
friends. If you have feature needs that Electron does not meet, you might want
71+
to try NW.js.
72+
73+
[nwjs]: https://nwjs.io/
74+
[electron-modules]: https://www.npmjs.com/search?q=electron
75+
[node-bindings]: https://github.com/electron/electron/tree/master/lib/common

0 commit comments

Comments
 (0)