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:
parent
42af68d763
commit
99b1f20d17
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user