From f76702bb44e7b9b504a74cc1535005aac1a0454a Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 15 May 2019 22:47:58 -0400 Subject: [PATCH] optimize if blocks --- src/electron/tray.main.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/electron/tray.main.ts b/src/electron/tray.main.ts index 7645cf6af7..e7418e06d9 100644 --- a/src/electron/tray.main.ts +++ b/src/electron/tray.main.ts @@ -121,19 +121,19 @@ export class TrayMain { } private toggleWindow() { - if (this.windowMain.win === null) { + if (this.windowMain.win == null) { if (process.platform === 'darwin') { // On MacOS, closing the window via the red button destroys the BrowserWindow instance. this.windowMain.createWindow().then(() => { this.windowMain.win.show(); }); } + return; + } + if (this.windowMain.win.isVisible()) { + this.windowMain.win.hide(); } else { - if (this.windowMain.win.isVisible()) { - this.windowMain.win.hide(); - } else { - this.windowMain.win.show(); - } + this.windowMain.win.show(); } }