|
| 1 | +const { app, BrowserWindow } = require('electron'); |
| 2 | + |
| 3 | +// Handle creating/removing shortcuts on Windows when installing/uninstalling. |
| 4 | +if (require('electron-squirrel-startup')) { // eslint-disable-line global-require |
| 5 | + app.quit(); |
| 6 | +} |
| 7 | + |
| 8 | +// Keep a global reference of the window object, if you don't, the window will |
| 9 | +// be closed automatically when the JavaScript object is garbage collected. |
| 10 | +let mainWindow; |
| 11 | + |
| 12 | +const createWindow = () => { |
| 13 | + // Create the browser window. |
| 14 | + mainWindow = new BrowserWindow({ |
| 15 | + width: 800, |
| 16 | + height: 600, |
| 17 | + }); |
| 18 | + |
| 19 | + // and load the index.html of the app. |
| 20 | + mainWindow.loadURL(`https://eager-archimedes-bdc476.netlify.com/`); |
| 21 | + |
| 22 | + mainWindow.webContents.openDevTools() |
| 23 | + |
| 24 | + // Emitted when the window is closed. |
| 25 | + mainWindow.on('closed', () => { |
| 26 | + // Dereference the window object, usually you would store windows |
| 27 | + // in an array if your app supports multi windows, this is the time |
| 28 | + // when you should delete the corresponding element. |
| 29 | + mainWindow = null; |
| 30 | + }); |
| 31 | +}; |
| 32 | + |
| 33 | +// This method will be called when Electron has finished |
| 34 | +// initialization and is ready to create browser windows. |
| 35 | +// Some APIs can only be used after this event occurs. |
| 36 | +app.on('ready', createWindow); |
| 37 | + |
| 38 | +// Quit when all windows are closed. |
| 39 | +app.on('window-all-closed', () => { |
| 40 | + // On OS X it is common for applications and their menu bar |
| 41 | + // to stay active until the user quits explicitly with Cmd + Q |
| 42 | + if (process.platform !== 'darwin') { |
| 43 | + app.quit(); |
| 44 | + } |
| 45 | +}); |
| 46 | + |
| 47 | +app.on('activate', () => { |
| 48 | + // On OS X it's common to re-create a window in the app when the |
| 49 | + // dock icon is clicked and there are no other windows open. |
| 50 | + if (mainWindow === null) { |
| 51 | + createWindow(); |
| 52 | + } |
| 53 | +}); |
| 54 | + |
| 55 | +// In this file you can include the rest of your app's specific main process |
| 56 | +// code. You can also put them in separate files and import them here. |
0 commit comments