mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-05 14:35:18 +00:00
main: Remove mainWindowState from globals.
(No, globals are not accessible from the other process.) Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
@@ -13,11 +13,7 @@ import * as CertificateUtil from '../renderer/js/utils/certificate-util';
|
|||||||
import * as ConfigUtil from '../renderer/js/utils/config-util';
|
import * as ConfigUtil from '../renderer/js/utils/config-util';
|
||||||
import * as ProxyUtil from '../renderer/js/utils/proxy-util';
|
import * as ProxyUtil from '../renderer/js/utils/proxy-util';
|
||||||
|
|
||||||
interface PatchedGlobal extends NodeJS.Global {
|
let mainWindowState: windowStateKeeper.State;
|
||||||
mainWindowState: windowStateKeeper.State;
|
|
||||||
}
|
|
||||||
|
|
||||||
const globalPatched = global as PatchedGlobal;
|
|
||||||
|
|
||||||
// Prevent window being garbage collected
|
// Prevent window being garbage collected
|
||||||
let mainWindow: Electron.BrowserWindow;
|
let mainWindow: Electron.BrowserWindow;
|
||||||
@@ -77,9 +73,6 @@ function createMainWindow(): Electron.BrowserWindow {
|
|||||||
path: `${app.getPath('userData')}/config`
|
path: `${app.getPath('userData')}/config`
|
||||||
});
|
});
|
||||||
|
|
||||||
// Let's keep the window position global so that we can access it in other process
|
|
||||||
globalPatched.mainWindowState = mainWindowState;
|
|
||||||
|
|
||||||
const win = new electron.BrowserWindow({
|
const win = new electron.BrowserWindow({
|
||||||
// This settings needs to be saved in config
|
// This settings needs to be saved in config
|
||||||
title: 'Zulip',
|
title: 'Zulip',
|
||||||
@@ -315,7 +308,7 @@ ${error}`
|
|||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('clear-app-settings', () => {
|
ipcMain.on('clear-app-settings', () => {
|
||||||
globalPatched.mainWindowState.unmanage();
|
mainWindowState.unmanage();
|
||||||
app.relaunch();
|
app.relaunch();
|
||||||
app.exit();
|
app.exit();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user