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

Simply implementation of sendToChannelInLensWindow

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-06-08 15:03:53 -04:00
parent 42af68d763
commit 99b1f20d17
3 changed files with 5 additions and 5 deletions

View File

@ -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 {

View File

@ -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);
}
},

View File

@ -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;