1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
const { app, BrowserWindow, ipcMain } = require('electron'); const path = require('path');
if (require('electron-squirrel-startup')) { app.quit(); }
const createWindow = () => { const mainWindow = new BrowserWindow({ width: 800, height: 600, webPreferences: { preload: path.join(__dirname, 'preload.js'), }, });
mainWindow.loadFile(path.join(__dirname, 'index.html'));
mainWindow.on('ready-to-show', () => { console.log('\twindow 1 -> ready-to-show') });
mainWindow.on('close', () => { console.log('\twindow 2 -> close') });
mainWindow.on('closed', () => { console.log('\twindow 3 -> closed') })
};
app.on('will-finish-launching', () => { console.log('app 1 -> will-finish-launching') }); app.on('ready', () => { console.log('app 2 -> ready') createWindow() });
app.on('before-quit', () => { console.log('app 3 -> before-quit') });
app.on('will-quit', () => { console.log('app 4 -> will-quit') });
app.on('quit', () => { console.log('app 5 -> quit') });
app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit(); } console.log('app 6 -> window-all-closed') });
|