app.js 926 B

123456789101112131415161718192021222324252627282930313233
  1. const spacedeck = require('./spacedeck')
  2. const electron = require('electron')
  3. const electronApp = electron.app
  4. const BrowserWindow = electron.BrowserWindow
  5. let mainWindow
  6. function createWindow () {
  7. mainWindow = new BrowserWindow({width: 1200, height: 700})
  8. mainWindow.loadURL("http://localhost:9666")
  9. mainWindow.on('closed', function () {
  10. mainWindow = null
  11. })
  12. }
  13. electronApp.on('ready', createWindow)
  14. // Quit when all windows are closed.
  15. electronApp.on('window-all-closed', function () {
  16. // On OS X it is common for applications and their menu bar
  17. // to stay active until the user quits explicitly with Cmd + Q
  18. if (process.platform !== 'darwin') {
  19. electronApp.quit()
  20. }
  21. })
  22. electronApp.on('activate', function () {
  23. // On OS X it's common to re-create a window in the app when the
  24. // dock icon is clicked and there are no other windows open.
  25. if (mainWindow === null) {
  26. createWindow()
  27. }
  28. })