Permalink
Switch branches/tags
1-3-x 1-4-x 1-5-x 1-6-x 1-7-x 1-8-x 2-0-x 2-1-x 3-0-x-appcontainer-trials 3-0-x 3-1-x 4-0-x 69_enable_logging add-args-spec add-vsts-status-to-readme add-web-frame-add-origin-access-whitelist-entry appcontainer-trials appveyor-test-reporter appveyor_gpu_test asan-tests backport-release-notes_4-0-x better-spec-runner brenca/accessibility-tests brenca/cookie-store-backport-4-0-x brenca/fix-14908 brenca/fix-paste-and-match-style-3-0-x build-gn buildFromTemplate-fix chromium-upgrade/71 cleanup-build-dirs-vsts deprecate-webframe-api dialog-refactor-p1 disable-color-correct-rendering docs-index e2e enable-mixed-sandbox enable-power-monitor-tests expect-browser-window-spec expect-crash-reporter-spec export-patches fetch-electron fetch_job_uaf_patch fix-build-with-enable_run_as_node-disabled fix-drag-region-crash fix-last-crash-report fix-memory-tracing fix-mixed-sandbox-tests fix-power-observer-dbus_3-0-x fix-remote-debugging fix-vsts-mac-gn fix-window-close fix-window-native-handle fix-windows-release-test fix-zoom-in-mac gn-add-nonproprietary-ffmpeg gn-babel gn-ci-builds gn-ci-sccache gn-circleci-mac gn-release-win gn-resource-conflict-omg-again-srsly gn-win-link ipc-filter jest-spike kthulu120/moveTopBackport lang lenient-locale-mkdirs make-cppcheck-happy master menu-accel migrate-setpath-logs miniak/desktop-capturer-filtering miniak/dock-api miniak/drop-mavericks miniak/fix-patch-description miniak/object-shorthand miniak/prefer-spread miniak/refactoring miniak/remote-promise-invoke miniak/remove-deprecated miniak/return-type-annotation miniak/screen-reader-detection miniak/tray-focus mkt/add-debugging-tools-to-windows-docs more-timeout multiple-globals no-chrome-common no-exit-event nornagon/gn-ci-builds ppontes/8100-backport-window.opener-null-fix-to-3-0-x ppontes/8100-use-proper-site-instance-candidate promise-changes promisify-affinity-tests promisify-cookies promisify-importcert promisify-tests publish-nightly-to-nightly reenable-nativeimage-specs release-1-7-x remove-blink_local_frame.patch rename-electron-build-configs resource-file-conflict-patch-explanation restore-clipboard-dcheck restore-url-dchecks restore-wtf-string-dcheck revert-10204-fix-window-opener revert-12293-revert-12193-master revert-15698-ppontes/8100-backport-window.opener-null-fix-to-4 rich-dialog roll-libcc route-permission-checks sandbox-ci-test single-core-fix-3-1-x system_netwok_context t-g test-build-appx test-change test-cr test-dirty-frame test-skips test-symbols-win unsafe-secure-origins url_fetcher_rewrite v2-sandbox wc-exec-js webui-resources webview-in-sandbox-renderer win-width-fix windows-powermonitor-shutdown-event wrap-docs-toc-in-element yolo-tests
Nothing to show
Find file Copy path
53 lines (36 sloc) 2.28 KB

Technical Differences Between Electron and NW.js (formerly node-webkit)

Note: Electron was previously named Atom Shell.

Like NW.js, Electron provides a platform to write desktop applications with JavaScript and HTML and has Node integration to grant access to the low level system from web pages.

But there are also fundamental differences between the two projects that make Electron a completely separate product from NW.js:

1. Entry of Application

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

In Electron, the entry point is a JavaScript script. Instead of providing a URL directly, you manually create a browser window and load an HTML file using the API. You also need to listen to window events to decide when to quit the application.

Electron works more like the Node.js runtime. Electron's APIs are lower level so you can use it for browser testing in place of PhantomJS.

2. Build System

In order to avoid the complexity of building all of Chromium, Electron uses libchromiumcontent to access Chromium's Content API. libchromiumcontent is a single shared library that includes the Chromium Content module and all of its dependencies. Users don't need a powerful machine to build Electron.

3. Node Integration

In NW.js, the Node integration in web pages requires patching Chromium to work, while in Electron we chose a different way to integrate the libuv loop with each platform's message loop to avoid hacking Chromium. See the node_bindings code for how that was done.

4. Multi-context

If you are an experienced NW.js user, you should be familiar with the concept of Node context and web context. These concepts were invented because of how NW.js was implemented.

By using the multi-context feature of Node, Electron doesn't introduce a new JavaScript context in web pages.

Note: NW.js has optionally supported multi-context since 0.13.