1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-01-24 14:36:52 +02:00
parent 60f6af4a0a
commit e062175343

View File

@ -7,6 +7,8 @@ import { toJS } from "mobx";
import logger from "../main/logger"; import logger from "../main/logger";
import { ClusterFrameInfo, clusterFrameMap } from "./cluster-frames"; import { ClusterFrameInfo, clusterFrameMap } from "./cluster-frames";
const subFramesChannel = "ipc:get-sub-frames";
export function handleRequest(channel: string, listener: (...args: any[]) => any) { export function handleRequest(channel: string, listener: (...args: any[]) => any) {
ipcMain.handle(channel, listener); ipcMain.handle(channel, listener);
} }
@ -29,7 +31,7 @@ export async function broadcastMessage(channel: string, ...args: any[]) {
let subFrames: ClusterFrameInfo[]; let subFrames: ClusterFrameInfo[];
if (ipcRenderer) { if (ipcRenderer) {
subFrames = await requestMain("ipc:get-sub-frames"); subFrames = await requestMain(subFramesChannel);
} else { } else {
subFrames = await getSubFrames(); subFrames = await getSubFrames();
} }
@ -81,7 +83,7 @@ export function unsubscribeAllFromBroadcast(channel: string) {
} }
export function bindBroadcastHandlers() { export function bindBroadcastHandlers() {
handleRequest("ipc:get-sub-frames", async () => { handleRequest(subFramesChannel, async () => {
return toJS(await getSubFrames(), { recurseEverything: true }); return toJS(await getSubFrames(), { recurseEverything: true });
}); });
} }