Skip to content

Commit

Permalink
add debug preference option
Browse files Browse the repository at this point in the history
  • Loading branch information
pvrobays committed Sep 13, 2021
1 parent db5a918 commit 33273cd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion example/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ const preferences = new ElectronPreferences({
},
// ...
},
debug: true,
webPreferences: {
devTools: true,
webSecurity: true
},
browserWindowOverrides: {
title: 'My Electron Preferences',
Expand Down
15 changes: 15 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ class ElectronPreferences extends EventEmitter2 {

const unOverridableWebPreferences = {
contextIsolation: true,
devTools: this.options.debug ? true : undefined
}

// User provider `browserWindow`, we load those
Expand Down Expand Up @@ -276,6 +277,12 @@ class ElectronPreferences extends EventEmitter2 {

this.prefsWindow.focus();

if (this.options.debug) {

this.prefsWindow.webContents.openDevTools();

}

return this.prefsWindow;

}
Expand Down Expand Up @@ -344,6 +351,14 @@ class ElectronPreferences extends EventEmitter2 {

});



if (this.options.debug) {

this.prefsWindow.webContents.openDevTools();

}

return this.prefsWindow;

}
Expand Down

0 comments on commit 33273cd

Please sign in to comment.