You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.8 KiB

  1. const electron = require('electron')
  2. // Module to control application life.
  3. const app = electron.app
  4. // Module to create native browser window.
  5. const BrowserWindow = electron.BrowserWindow
  6. // Keep a global reference of the window object, if you don't, the window will
  7. // be closed automatically when the JavaScript object is garbage collected.
  8. let mainWindow
  9. function createWindow () {
  10. // Create the browser window.
  11. mainWindow = new BrowserWindow({width: 1100, height: 650})
  12. mainWindow.setMenu(null);
  13. // and load the index.html of the app.
  14. mainWindow.loadURL(`file://${__dirname}/index.html`)
  15. // Open the DevTools.
  16. //mainWindow.webContents.openDevTools()
  17. // Emitted when the window is closed.
  18. mainWindow.on('closed', function () {
  19. // Dereference the window object, usually you would store windows
  20. // in an array if your app supports multi windows, this is the time
  21. // when you should delete the corresponding element.
  22. mainWindow = null
  23. })
  24. }
  25. // This method will be called when Electron has finished
  26. // initialization and is ready to create browser windows.
  27. // Some APIs can only be used after this event occurs.
  28. app.on('ready', createWindow)
  29. // Quit when all windows are closed.
  30. app.on('window-all-closed', function () {
  31. // On OS X 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') {
  34. app.quit()
  35. }
  36. })
  37. app.on('activate', function () {
  38. // On OS X it's common to re-create a window in the app when the
  39. // dock icon is clicked and there are no other windows open.
  40. if (mainWindow === null) {
  41. createWindow()
  42. }
  43. })
  44. // In this file you can include the rest of your app's specific main process
  45. // code. You can also put them in separate files and require them here.