fix missing event on ipcMain.emit

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and Sebastian Malton committed 2022-01-24 11:05:00 -05:00
1 parent 5c8139b025
commit b0f4691778
1 file changed
+7 -4
+7 -4
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";