|
Size: 804
Comment:
|
Size: 881
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 45: | Line 45: |
| For details on `BrowserWindow`, see [[Node/Electron/BrowserWindow|here]]. |
Electron App
Contents
App
const { app, BrowserWindow } = 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();
});For details on BrowserWindow, see here.
