electron-main.dev.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * This file is used specifically and only for development. It installs
  3. * `electron-debug` & `vue-devtools`. There shouldn't be any need to
  4. * modify this file, but it can be used to extend your development
  5. * environment.
  6. */
  7. import electronDebug from 'electron-debug'
  8. import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
  9. import { app, BrowserWindow } from 'electron'
  10. app.whenReady().then(() => {
  11. // allow for a small delay for mainWindow to be created
  12. setTimeout(() => {
  13. // Install `electron-debug` with `devtron`
  14. electronDebug({ showDevTools: false })
  15. // Install vuejs devtools
  16. installExtension(VUEJS_DEVTOOLS)
  17. .then(name => {
  18. console.log(`Added Extension: ${name}`)
  19. // get main window
  20. const win = BrowserWindow.getFocusedWindow()
  21. if (win) {
  22. win.webContents.on('did-frame-finish-load', () => {
  23. win.webContents.once('devtools-opened', () => {
  24. win.webContents.focus()
  25. })
  26. // open electron debug
  27. console.log('Opening dev tools')
  28. win.webContents.openDevTools()
  29. })
  30. }
  31. })
  32. .catch(err => {
  33. console.log('An error occurred: ', err)
  34. })
  35. }, 250)
  36. })
  37. import './electron-main'