1
0

index.js 1.5 KB

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