From 3c8925ef760cc7181611604a24aa5ae2a8752e53 Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Thu, 9 Mar 2017 15:14:16 -0500 Subject: [PATCH] [client-app] don't re-close dev tools Summary: If you have the console open and are looking at the Source panel or something, this will constantly bring you back to the Console panel. Won't do that anymore with this chec Test Plan: manual Reviewers: spang, mark, halla, juan Reviewed By: mark, halla, juan Differential Revision: https://phab.nylas.com/D4162 --- packages/client-app/src/nylas-env.es6 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/client-app/src/nylas-env.es6 b/packages/client-app/src/nylas-env.es6 index bfac849cb..f33949c92 100644 --- a/packages/client-app/src/nylas-env.es6 +++ b/packages/client-app/src/nylas-env.es6 @@ -333,8 +333,10 @@ export default class NylasEnvConstructor { if (this.inSpecMode()) { jasmine.getEnv().currentSpec.fail(error); } else if (this.inDevMode() && !noWindows) { - this.openDevTools(); - this.executeJavaScriptInDevTools("DevToolsAPI.showPanel('console')"); + if (!this.isDevToolsOpened()) { + this.openDevTools(); + this.executeJavaScriptInDevTools("DevToolsAPI.showPanel('console')"); + } } this.errorLogger.reportError(error, extra); @@ -999,6 +1001,10 @@ export default class NylasEnvConstructor { return ipcRenderer.send('call-webcontents-method', 'openDevTools'); } + isDevToolsOpened() { + return this.getCurrentWindow().webContents.isDevToolsOpened() + } + // Extended: Toggle the visibility of the dev tools for the current window. toggleDevTools() { return ipcRenderer.send('call-webcontents-method', 'toggleDevTools');