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 {
|
export interface SendToViewArgs {
|
||||||
channel: string;
|
channel: string;
|
||||||
frameInfo?: ClusterFrameInfo;
|
frameInfo?: ClusterFrameInfo;
|
||||||
data?: unknown[];
|
data?: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LensWindow {
|
export interface LensWindow {
|
||||||
|
|||||||
@ -13,16 +13,16 @@ const sendToChannelInElectronBrowserWindowInjectable = getInjectable({
|
|||||||
() =>
|
() =>
|
||||||
(
|
(
|
||||||
browserWindow: BrowserWindow,
|
browserWindow: BrowserWindow,
|
||||||
{ channel, frameInfo, data = [] }: SendToViewArgs,
|
{ channel, frameInfo, data }: SendToViewArgs,
|
||||||
) => {
|
) => {
|
||||||
if (frameInfo) {
|
if (frameInfo) {
|
||||||
browserWindow.webContents.sendToFrame(
|
browserWindow.webContents.sendToFrame(
|
||||||
[frameInfo.processId, frameInfo.frameId],
|
[frameInfo.processId, frameInfo.frameId],
|
||||||
channel,
|
channel,
|
||||||
...data,
|
data,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
browserWindow.webContents.send(channel, ...data);
|
browserWindow.webContents.send(channel, data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ const messageToChannelInjectable = getInjectable({
|
|||||||
for (const window of getVisibleWindows()) {
|
for (const window of getVisibleWindows()) {
|
||||||
window.send({
|
window.send({
|
||||||
channel: channel.id,
|
channel: channel.id,
|
||||||
data: message !== undefined ? [message] : [],
|
data: message,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}) as MessageToChannel;
|
}) as MessageToChannel;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user