1. Initialize project (npm init)

2. install electron frame (npm install --save-dev electron)

3. hold package Configuration file startup entry changed to "start": "electron ."

4. Prepare entry document (index/main).js
const { app, BrowserWindow } = require('electron') //
Keep it right window A global reference to an object , If not , When JavaScript The object is // When it comes to recycling ,window The object will be closed automatically let win
function createWindow () { // Create browser window . win = new BrowserWindow({ width: 800,
height: 600 }) // Then load the index.html. win.loadFile('index.html') // Open developer tools
win.webContents.openDevTools()// When window Shut down , This event will be triggered . win.on('closed', () => {
// Dereference window object , If your application supports multiple windows , // It's usually more than one window Objects are stored in an array , //
meanwhile , You should delete the corresponding elements . win = null }) } // Electron After initialization and preparation // When creating a browser window , Call this function . //
part API stay ready It can only be used after the event is triggered . app.on('ready', createWindow) // Exit when all windows are closed . app.on(
'window-all-closed', () => { // stay macOS upper , Unless the user uses Cmd + Q Exit with certainty , //
Otherwise, most applications and their menu bar will remain active . if (process.platform !== 'darwin') { app.quit() } }) app.on(
'activate', () => { // stay macOS upper , When you click dock Icon and no other windows open , // A window is usually recreated in the application . if
(win ===null) { createWindow() } })
5. Create the html Interface
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Hello World!</title
> </head> <body> <h1>Hello World!</h1> </body> </html>
6. function npm Start command (npm start)

Technology
©2019-2020 Toolsou All rights reserved,
It's unexpected Python Cherry tree (turtle The gorgeous style of Library ) Some East 14 Pay change 16 salary , Sincerity or routine ? Browser kernel ( understand )java Four functional interfaces ( a key , simple )HashMap Explain in detail html Writing about cherry trees , Writing about cherry trees os Simple use of module