1// Modules to control application life and create native browser window 2const {app, BrowserWindow} = require('electron'); 3const path = require('path'); 4 5function createWindow() { 6 // Create the browser window. 7 const mainWindow = new BrowserWindow({ 8 width: 1440, 9 height: 900, 10 webPreferences: { 11 nodeIntegration: 12 true, // For opening file dialog from the renderer process 13 enableRemoteModule: true // For require('electron').remote 14 } 15 }); 16 17 // and load the index.html of the app. 18 mainWindow.loadFile('index.html'); 19 20 // Open the DevTools. 21 // mainWindow.webContents.openDevTools() 22} 23 24// This method will be called when Electron has finished 25// initialization and is ready to create browser windows. 26// Some APIs can only be used after this event occurs. 27app.whenReady().then(createWindow); 28 29// Quit when all windows are closed. 30app.on('window-all-closed', function() { 31 // On macOS it is common for applications and their menu bar 32 // to stay active until the user quits explicitly with Cmd + Q 33 if (process.platform !== 'darwin') app.quit(); 34}) 35 36app.on('activate', function() { 37 // On macOS it's common to re-create a window in the app when the 38 // dock icon is clicked and there are no other windows open. 39 if (BrowserWindow.getAllWindows().length === 0) createWindow(); 40}); 41 42// In this file you can include the rest of your app's specific main process 43// code. You can also put them in separate files and require them here. 44