2022-08-15 06:53:14 +02:00
|
|
|
const { ipcRenderer, contextBridge } = require("electron");
|
|
|
|
|
2022-08-15 09:06:31 +02:00
|
|
|
// 'ipcRenderer' will be available in index.js with the method 'window.electron'
|
2022-08-17 04:37:50 +02:00
|
|
|
contextBridge.exposeInMainWorld("electron", {
|
|
|
|
send: (command, payload) => ipcRenderer.send(command, payload),
|
|
|
|
on: (command, func) =>
|
|
|
|
ipcRenderer.on(command, (event, args) => {
|
2022-08-17 13:36:19 +02:00
|
|
|
func(event, args);
|
2022-08-17 04:37:50 +02:00
|
|
|
}),
|
2022-08-17 11:18:49 +02:00
|
|
|
invoke: (command, payload) => ipcRenderer.invoke(command, payload),
|
2022-08-17 04:37:50 +02:00
|
|
|
});
|