blob: a42b2bc1f1630eeb218acd2855f0fbfea7c1f335 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import { ipcMain, WebContents } from 'electron';
import { createIpcMain } from '../shared/ipc-helpers';
import { ipcSchema } from '../shared/ipc-schema';
// eslint-disable-next-line @typescript-eslint/naming-convention
export let IpcMainEventChannel = createIpcMain(ipcSchema, ipcMain, undefined);
// Change the `IpcMainEventChannel` for a new one with a new `WebContents`.
export function changeIpcWebContents(webContents: WebContents | undefined) {
IpcMainEventChannel = createIpcMain(ipcSchema, ipcMain, webContents);
}
export function unsetIpcWebContents() {
changeIpcWebContents(undefined);
}
|