Simply implementation of sendToChannelInLensWindow

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2022-07-06 11:42:46 -04:00
1 parent 42af68d763
commit 99b1f20d17
3 files changed
+5 -5

No files matched your search

@@ -8,7 +8,7 @@ import type { ClusterFrameInfo } from "../../../../common/cluster-frames";
export interface SendToViewArgs {
channel: string;
frameInfo?: ClusterFrameInfo;
data?: unknown[];
data?: unknown;
}
export interface LensWindow {
@@ -13,16 +13,16 @@ const sendToChannelInElectronBrowserWindowInjectable = getInjectable({
() =>
(
browserWindow: BrowserWindow,
{ channel, frameInfo, data = [] }: SendToViewArgs,
{ channel, frameInfo, data }: SendToViewArgs,
) => {
if (frameInfo) {
browserWindow.webContents.sendToFrame(
[frameInfo.processId, frameInfo.frameId],
channel,
...data,
data,
);
} else {
browserWindow.webContents.send(channel, ...data);
browserWindow.webContents.send(channel, data);
}
},
@@ -17,7 +17,7 @@ const messageToChannelInjectable = getInjectable({
for (const window of getVisibleWindows()) {
window.send({
channel: channel.id,
data: message !== undefined ? [message] : [],
data: message,
});
}
}) as MessageToChannel;