1
0

index.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use strict';
  2. const electron = require('electron');
  3. const app = electron.app; // Module to control application life.
  4. const BrowserWindow = electron.BrowserWindow; // Module to create native browser window.
  5. // Keep a global reference of the window object, if you don't, the window will
  6. // be closed automatically when the JavaScript object is garbage collected.
  7. var mainWindow = null;
  8. // Quit when all windows are closed.
  9. app.on('window-all-closed', function() {
  10. // On OS X it is common for applications and their menu bar
  11. // to stay active until the user quits explicitly with Cmd + Q
  12. if (process.platform != 'darwin') {
  13. app.quit();
  14. }
  15. });
  16. // This method will be called when Electron has finished
  17. // initialization and is ready to create browser windows.
  18. app.on('ready', function() {
  19. // Create the browser window.
  20. mainWindow = new BrowserWindow({width: 800, height: 600});
  21. // and load the index.html of the app.
  22. mainWindow.loadURL('file://' + __dirname + '/index.html');
  23. // Open the DevTools.
  24. //mainWindow.webContents.openDevTools();
  25. // Emitted when the window is closed.
  26. mainWindow.on('closed', function() {
  27. // Dereference the window object, usually you would store windows
  28. // in an array if your app supports multi windows, this is the time
  29. // when you should delete the corresponding element.
  30. mainWindow = null;
  31. });
  32. });