From 99b1f20d177c0fb818887249cdf363a6cd00848c Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 8 Jun 2022 15:03:53 -0400 Subject: [PATCH] Simply implementation of sendToChannelInLensWindow Signed-off-by: Sebastian Malton --- .../application-window/lens-window-injection-token.ts | 2 +- ...send-to-channel-in-electron-browser-window.injectable.ts | 6 +++--- src/main/utils/channel/message-to-channel.injectable.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/start-main-application/lens-window/application-window/lens-window-injection-token.ts b/src/main/start-main-application/lens-window/application-window/lens-window-injection-token.ts index 04c0939a6a..2e30670b10 100644 --- a/src/main/start-main-application/lens-window/application-window/lens-window-injection-token.ts +++ b/src/main/start-main-application/lens-window/application-window/lens-window-injection-token.ts @@ -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 { diff --git a/src/main/start-main-application/lens-window/application-window/send-to-channel-in-electron-browser-window.injectable.ts b/src/main/start-main-application/lens-window/application-window/send-to-channel-in-electron-browser-window.injectable.ts index 32422b6a94..7147837fe0 100644 --- a/src/main/start-main-application/lens-window/application-window/send-to-channel-in-electron-browser-window.injectable.ts +++ b/src/main/start-main-application/lens-window/application-window/send-to-channel-in-electron-browser-window.injectable.ts @@ -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); } }, diff --git a/src/main/utils/channel/message-to-channel.injectable.ts b/src/main/utils/channel/message-to-channel.injectable.ts index f45bf5cde0..80a80845b3 100644 --- a/src/main/utils/channel/message-to-channel.injectable.ts +++ b/src/main/utils/channel/message-to-channel.injectable.ts @@ -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;