index.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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({
  21. width: 450,
  22. height: 160,
  23. 'min-width': 450,
  24. 'min-height': 160,
  25. 'accept-first-mouse': true
  26. });
  27. // and load the index.html of the app.
  28. mainWindow.loadURL('file://' + __dirname + '/front-end/index.html');
  29. // Open the DevTools.
  30. mainWindow.webContents.openDevTools();
  31. // Emitted when the window is closed.
  32. mainWindow.on('closed', function() {
  33. // Dereference the window object, usually you would store windows
  34. // in an array if your app supports multi windows, this is the time
  35. // when you should delete the corresponding element.
  36. mainWindow = null;
  37. });
  38. });