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.

39 lines
722B

  1. const {app, BrowserWindow} = require('electron');
  2. const path = require('path');
  3. const url = require('url');
  4. let mainWindow;
  5. function createWindow(){
  6. mainWindow = new BrowserWindow({
  7. width: 800,
  8. height: 600,
  9. webPreferences: {
  10. nodeIntegration: true
  11. }
  12. });
  13. mainWindow.loadURL(url.format({
  14. pathname: path.join(__dirname, 'view/index.html'),
  15. protocol: 'file',
  16. slashes: true
  17. }));
  18. mainWindow.webContents.openDevTools();
  19. mainWindow.on('closed', ()=>{mainWindow = null;})
  20. }
  21. app.on('ready', createWindow);
  22. app.on('window-all-closed', ()=>{
  23. if (process.platform !== 'darwin')
  24. app.quit();
  25. });
  26. app.on('activate', ()=> {
  27. if (mainWindow === null){
  28. createWindow();
  29. }
  30. });