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.

41 lines
1.4 KiB

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