⇤ ← Revision 1 as of 2023-03-02 17:31:01
Size: 785
Comment:
|
Size: 789
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 12: | Line 12: |
const { app } = require("electron"); | const { app } = require('electron'); |
Line 23: | Line 23: |
preload: filePreload, | preload: 'preload.js', |
Line 27: | Line 27: |
win.loadFile(fileIndex); | win.loadFile('index.html'); |
Line 29: | Line 29: |
win.on("closed", () => { | win.on('closed', () => { |
Line 34: | Line 34: |
app.on("ready", initializeWindow); | app.on('ready', initializeWindow); |
Line 36: | Line 36: |
app.on("window-all-closed", () => { | app.on('window-all-closed', () => { |
Line 40: | Line 40: |
app.on("activate", () => { | app.on('activate', () => { |
Electron App
Contents
App
const { app } = require('electron'); var win; function initializeWindow() { win = new BrowserWindow({ width: 800, height: 600, webPreferences: { contextIsolation: true, nodeIntegration: false, preload: 'preload.js', } }); win.loadFile('index.html'); win.on('closed', () => { win = null; }); }; app.on('ready', initializeWindow); app.on('window-all-closed', () => { if (process.platform !== "darwin") app.quit(); }); app.on('activate', () => { if (win === null) initializeWindow(); });