electron.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. const electron = require('electron');
  2. const { app, crashReporter } = require('electron')
  3. console.log("80085");
  4. console.log(app.getPath('crashDumps'))
  5. crashReporter.start({ uploadToServer: false })
  6. // Module to control application life.
  7. //const app = electron.app;
  8. // Module to create native browser window.
  9. const BrowserWindow = electron.BrowserWindow;
  10. const path = require('path');
  11. const url = require('url');
  12. const isDev = require('electron-is-dev');
  13. // Keep a global reference of the window object, if you don't, the window will
  14. // be closed automatically when the JavaScript object is garbage collected.
  15. let mainWindow;
  16. function createWindow() {
  17. // Create the browser window.
  18. mainWindow = new BrowserWindow({width: 1280, height: 800});
  19. // and load the index.html of the app.
  20. mainWindow.loadURL(isDev ? 'http://localhost:3000' : `file://${path.join(__dirname, '../build/index.html')}`);
  21. // Open the DevTools.
  22. mainWindow.menuBarVisible=false;
  23. // Emitted when the window is closed.
  24. mainWindow.on('closed', function () {
  25. // Dereference the window object, usually you would store windows
  26. // in an array if your app supports multi windows, this is the time
  27. // when you should delete the corresponding element.
  28. mainWindow = null
  29. })
  30. }
  31. // This method will be called when Electron has finished
  32. // initialization and is ready to create browser windows.
  33. // Some APIs can only be used after this event occurs.
  34. app.on('ready', createWindow);
  35. // Quit when all windows are closed.
  36. app.on('window-all-closed', function () {
  37. // On OS X it is common for applications and their menu bar
  38. // to stay active until the user quits explicitly with Cmd + Q
  39. if (process.platform !== 'darwin') {
  40. app.quit()
  41. }
  42. });
  43. app.on('activate', function () {
  44. // On OS X it's common to re-create a window in the app when the
  45. // dock icon is clicked and there are no other windows open.
  46. if (mainWindow === null) {
  47. createWindow()
  48. }
  49. });
  50. // In this file you can include the rest of your app's specific main process
  51. // code. You can also put them in separate files and require them here.