1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

optimize if blocks

This commit is contained in:
Kyle Spearrin
2019-05-15 22:47:58 -04:00
parent 1bcd430884
commit f76702bb44

View File

@@ -121,21 +121,21 @@ export class TrayMain {
} }
private toggleWindow() { private toggleWindow() {
if (this.windowMain.win === null) { if (this.windowMain.win == null) {
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
// On MacOS, closing the window via the red button destroys the BrowserWindow instance. // On MacOS, closing the window via the red button destroys the BrowserWindow instance.
this.windowMain.createWindow().then(() => { this.windowMain.createWindow().then(() => {
this.windowMain.win.show(); this.windowMain.win.show();
}); });
} }
} else { return;
}
if (this.windowMain.win.isVisible()) { if (this.windowMain.win.isVisible()) {
this.windowMain.win.hide(); this.windowMain.win.hide();
} else { } else {
this.windowMain.win.show(); this.windowMain.win.show();
} }
} }
}
private closeWindow() { private closeWindow() {
this.windowMain.isQuitting = true; this.windowMain.isQuitting = true;