default_app.js 608 B

12345678910111213141516171819202122232425262728
  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. useContentSize: true
  16. }
  17. if (process.platform === 'linux') {
  18. options.icon = path.join(__dirname, 'icon.png')
  19. }
  20. mainWindow = new BrowserWindow(options)
  21. mainWindow.loadURL(appUrl)
  22. mainWindow.focus()
  23. })
  24. }