Electron Quick Start
Why
Electron enables you easily to create desktop applications with Node.
Pure javascript&CSS&HTML is funtastic.
HOW
Electron is not a GUI binding javascript. Instead, Electron uses web pages as its GUI, so you could also see it as a minimal Chromium browser, controlled by JavaScript.
Main Process
In Electron, the process that runs package.json’s main script is called the main process. The script that runs in the main process can display a GUI by creating web pages.
Renderer Process
Since Electron uses Chromium for displaying web pages, Chromium’s multi-process architecture is also used. Each web page in Electron runs in its own process, which is called the renderer process.
Start
files structure
1 | . |
main.js
1 | const {app, BrowserWindow} = require('electron') |
index.html
1 |
|
Run this application
Install electron locally
1 | $ npm install electron |
macOS / Linux
1 | $ ./node_modules/.bin/electron . |
Windows
1 | $ .\node_modules\.bin\electron . |