1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

fix missing event on ipcMain.emit

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2022-01-04 18:42:05 +02:00 committed by Sebastian Malton
parent 5c8139b025
commit b0f4691778

View File

@ -31,20 +31,23 @@ function getSubFrames(): ClusterFrameInfo[] {
export async function broadcastMessage(channel: string, ...args: any[]): Promise<void> {
if (ipcRenderer) {
return requestMain(broadcastMainChannel, ...args);
return requestMain(broadcastMainChannel, channel, ...args);
}
if (!webContents) {
if (!ipcMain) {
return;
}
ipcMain.listeners(channel).forEach((func) => func({
processId: undefined, frameId: undefined, sender: undefined, senderFrame: undefined,
}, ...args));
const subFrames = getSubFrames();
const views = webContents.getAllWebContents();
if (!views || !Array.isArray(views) || views.length === 0) return;
args = args.map(sanitizePayload);
ipcMain?.emit(channel, ...args);
args = args.map(sanitizePayload);
for (const view of views) {
let viewType = "unknown";