calling openDevTools from window.webContents

This commit is contained in:
antelle 2020-05-15 21:54:34 +02:00
parent c73f81a80a
commit 099f1ca9d0
No known key found for this signature in database
GPG Key ID: 094A2F2D6136A4EE
2 changed files with 5 additions and 4 deletions

View File

@ -38,7 +38,7 @@ const Launcher = {
openDevTools() {
this.electron()
.remote.getCurrentWindow()
.openDevTools({ mode: 'bottom' });
.webContents.openDevTools({ mode: 'bottom' });
},
getSaveFileName(defaultPath, callback) {
if (defaultPath) {

View File

@ -207,9 +207,6 @@ function createMainWindow() {
perfTimestamps?.push({ name: 'setting menu', ts: process.hrtime() });
mainWindow.loadURL(htmlPath);
if (showDevToolsOnStart) {
mainWindow.openDevTools({ mode: 'bottom' });
}
mainWindow.once('ready-to-show', () => {
perfTimestamps?.push({ name: 'main window ready', ts: process.hrtime() });
if (startMinimized) {
@ -221,6 +218,10 @@ function createMainWindow() {
notifyOpenFile();
perfTimestamps?.push({ name: 'main window shown', ts: process.hrtime() });
reportStartProfile();
if (showDevToolsOnStart) {
mainWindow.webContents.openDevTools({ mode: 'bottom' });
}
});
mainWindow.webContents.on('context-menu', onContextMenu);
mainWindow.on('resize', delaySaveMainWindowPosition);