Electron is a framework that lets you create desktop applications using JavaScript, HTML and CSS. These apps can be packaged to run directly on macOS, Windows and Linux, or distributed through the Mac App Store or Microsoft Store.
Install the electron – forge
Electron Forge is a perfect tool for building modern Electron applications.
yarn add global electron-forge
Create a project
electron-forge init my-electron-project
Or in an existing empty directory
electron-forge init .
Or under the electron project that we already have
electron-forge import
Start the
yarn start
build
yarn make
The development of
Electron has two kinds of processes: the main process and the render process
SRC /index.js is the only main process entry for the entire application. It can create page Windows through BrowserWindow, and each page corresponds to a rendering process
const mainWindow = new BrowserWindow({
width: 800.height: 600});Copy the code
An instance of BrowserWindow loads SRC /index.html and is displayed as a page
mainWindow.loadFile(path.join(__dirname, 'index.html'));
Copy the code
If you need to call the local file manipulation function, you can call the main process for fs file manipulation