Chapter 2. Introduction to Electron
What does building an application with Electron actually look like? In this chapter, we discuss how an app is built from the ground up and how one integrates it with the operating system for a native user experience.
This introduction covers Electron’s most commonly used modules and APIs, but certainly not all of them. At the time of writing, more than a 1,700 modules containing the tag electron are available on npm, and that number will certainly grow. You will, however, learn the fundamental patterns. And once you have a grip on how Electron’s individual pieces fit together, how its modules and APIs generally work, and how it integrates with the operating system, you will understand Electron development.
Building an application with Electron is essentially Node.js development. To follow along with the exercises in this chapter, you need Node.js (at least version 7) and npm (at least version 4).
Hello World: A Small Code Editor
These days, simply printing a text line to the terminal is hardly impressive. To illustrate how an Electron application is typically developed, we will build a simple code editor (see Figure 2-1), similar to Visual Studio Code, Atom, or Sublime.
Electron’s homepage recommends a CLI tool called electron-forge or an example repository called electron-quick-start. While both are useful, knowing how an Electron application is bootstrapped is required to understand how an Electron application’s life cycle works. We will ...
Get Introducing Electron now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.