Switch to more specific IPC helpers (#2821)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-06-10 10:34:22 -04:00
1 parent a12cb0a16e
commit 280af6391e
18 files changed
+191 -178

No files matched your search

+2 -1
View File
@@ -24,6 +24,7 @@ import { Disposers } from "../lens-extension";
import type { LensMainExtension } from "../lens-main-extension";
import type { Disposer } from "../../common/utils";
import { once } from "lodash";
import { ipcMainHandle } from "../../common/ipc";
export abstract class IpcMain extends IpcRegistrar {
constructor(extension: LensMainExtension) {
@@ -55,7 +56,7 @@ export abstract class IpcMain extends IpcRegistrar {
handle(channel: string, handler: (event: Electron.IpcMainInvokeEvent, ...args: any[]) => any): void {
const prefixedChannel = `extensions@${this[IpcPrefix]}:${channel}`;
ipcMain.handle(prefixedChannel, handler);
ipcMainHandle(prefixedChannel, handler);
this.extension[Disposers].push(() => ipcMain.removeHandler(prefixedChannel));
}
}