Skip to content

Commit

Permalink
app: Update desktopApi send method to accept multiple args
Browse files Browse the repository at this point in the history
This patch updates the send method to accept
multiple arguments. This allows for more
flexibility in sending data via IPC channels
from renderer process to the main process

Signed-off-by: yolossn <sannagaraj@microsoft.com>
  • Loading branch information
yolossn committed May 13, 2024
1 parent 3a49838 commit 584b09d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/electron/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { contextBridge, ipcRenderer } from 'electron';
// Expose protected methods that allow the renderer process to use
// the ipcRenderer without exposing the entire object
contextBridge.exposeInMainWorld('desktopApi', {
send: (channel, data) => {
send: (channel, ...data) => {
// allowed channels
const validChannels = [
'setMenu',
Expand All @@ -18,7 +18,7 @@ contextBridge.exposeInMainWorld('desktopApi', {
'cancel-plugin-process',
];
if (validChannels.includes(channel)) {
ipcRenderer.send(channel, data);
ipcRenderer.send(channel, ...data);
}
},
receive: (channel, func) => {
Expand Down

0 comments on commit 584b09d

Please sign in to comment.