Skip to content

Commit 2bbe00e

Browse files
committed
Don't open DevTools until the DOM is ready
To prevent logging noise. See: electron/electron#12438
1 parent 47cb6e7 commit 2bbe00e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,19 @@ module.exports = opts => {
7070
return;
7171
}
7272

73-
app.on('browser-window-created', (e, win) => {
73+
app.on('browser-window-created', (event, win) => {
7474
if (opts.showDevTools) {
75-
openDevTools(win, opts.showDevTools);
75+
win.webContents.once('devtools-opened', () => {
76+
// Workaround for https://github.com/electron/electron/issues/13095
77+
setImmediate(() => {
78+
win.focus();
79+
});
80+
});
81+
82+
/// Workaround for https://github.com/electron/electron/issues/12438
83+
win.webContents.once('dom-ready', () => {
84+
openDevTools(win, opts.showDevTools);
85+
});
7686
}
7787
});
7888

0 commit comments

Comments
 (0)