Chapter 6. Exploring NW.js and Electron’s internals

 

This chapter covers

  • Understanding how NW.js and Electron combine Node.js and Chromium
  • Developing with Electron’s multi-process approach
  • Building with NW.js’s shared-context approach
  • Sharing state by passing messages

Although NW.js and Electron consist of the same software components, and Cheng Zhao has influenced the development of both, the two frameworks have evolved different approaches to how they function under the hood. Analyzing how they operate internally will help you understand what’s going on when you’re running an app and demystify the software.

In this chapter, we’ll look at how NW.js and Electron function internally. We’ll take a look at NW.js first to see how it combines Node.js with Chromium (because that was the first Node.js desktop app framework) and then explore how Electron took a different approach to combining those software components. Following that, we’ll look at the frameworks’ different approaches to context and state. I’ll then elaborate a bit on Electron’s use of message passing to transmit data as state between the processes in a desktop app.

We’ll also look at some resources for further reading. The goal is that you’ll be in a good position to understand how the two frameworks differ in their internal architecture and the implications this has on building desktop apps with them.

6.1. How does NW.js work under the hood?

6.2. How does Electron work under the hood?

6.3. How does Node.js work with NW.js and Electron?

6.4. Summary

sitemap