renderer: Use ipcRenderer.sendTo to communicate with other WebContents.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-04-25 19:34:34 -07:00
parent 3b3fa88c89
commit 994c412bd2
5 changed files with 26 additions and 23 deletions

View File

@@ -125,7 +125,7 @@ function sendAction(action: string): void {
win.restore();
}
win.webContents.send(action);
ipcRenderer.sendTo(win.webContents.id, action);
}
const createTray = function (): void {
@@ -219,8 +219,7 @@ function toggleTray(): void {
const selector = "webview:not([class*=disabled])";
const webview: WebviewTag = document.querySelector(selector)!;
const webContents = remote.webContents.fromId(webview.getWebContentsId());
webContents.send("toggletray", state);
ipcRenderer.sendTo(webview.getWebContentsId(), "toggletray", state);
}
ipcRenderer.on("toggletray", toggleTray);