default_app.js 679 B

12345678910111213141516171819202122232425262728293031
  1. const {app, BrowserWindow} = require('electron')
  2. const path = require('path')
  3. let mainWindow = null
  4. // Quit when all windows are closed.
  5. app.on('window-all-closed', () => {
  6. app.quit()
  7. })
  8. exports.load = (appUrl) => {
  9. app.on('ready', () => {
  10. const options = {
  11. width: 800,
  12. height: 600,
  13. autoHideMenuBar: true,
  14. backgroundColor: '#FFFFFF',
  15. webPreferences: {
  16. nodeIntegrationInWorker: true
  17. },
  18. useContentSize: true
  19. }
  20. if (process.platform === 'linux') {
  21. options.icon = path.join(__dirname, 'icon.png')
  22. }
  23. mainWindow = new BrowserWindow(options)
  24. mainWindow.loadURL(appUrl)
  25. mainWindow.focus()
  26. })
  27. }