10 lines
341 B
JavaScript
10 lines
341 B
JavaScript
|
const { contextBridge, ipcRenderer } = require('electron')
|
||
|
contextBridge.exposeInMainWorld('electronApi', {
|
||
|
sendMessage: async (channelNameArg, payloadArg) => {
|
||
|
ipcRenderer.send(channelNameArg, payloadArg);
|
||
|
},
|
||
|
receiveMessage: (channelNameArg, func) => {
|
||
|
ipcRenderer.on(channelNameArg, (event, ...args) => func(...args));
|
||
|
}
|
||
|
});
|