Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsBurgh committed Jun 17, 2020
1 parent 4d36524 commit 0b99bd2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/main/index.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@

/* eslint-disable */

const { app } = require('electron')
const { default: installExtension, VUEJS_DEVTOOLS } = require('electron-devtools-installer')

// Install `electron-debug` with `devtron`
require('electron-debug')({ showDevTools: true })
// NB: Don't open dev tools with this, it is causing the error
require('electron-debug')()

// Install `vue-devtools`
require('electron').app.on('ready', () => {
let installExtension = require('electron-devtools-installer')
installExtension.default(installExtension.VUEJS_DEVTOOLS)
.then(() => {})
.catch(err => {
console.log('Unable to install `vue-devtools`: \n', err)
})
app.on('ready', () => {
installExtension(VUEJS_DEVTOOLS)
.then((name) => console.log(`Added Extension: ${name}`))
.catch((err) => console.log('An error occurred: ', err));
})

// Require `main` process to boot app
require('./index')
require('./index')
10 changes: 10 additions & 0 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ function createWindow () {

mainWindow.loadURL(winURL)

// Open dev tools initially when in development mode
if (process.env.NODE_ENV === 'development') {
mainWindow.webContents.on('did-frame-finish-load', () => {
mainWindow.webContents.once('devtools-opened', () => {
mainWindow.focus()
})
mainWindow.webContents.openDevTools()
})
}

mainWindow.on('closed', () => {
mainWindow = null
})
Expand Down

0 comments on commit 0b99bd2

Please sign in to comment.