2022-08-15 10:23:14 +05:30
|
|
|
const { ipcRenderer, contextBridge } = require("electron");
|
|
|
|
|
2022-08-15 12:36:31 +05:30
|
|
|
// 'ipcRenderer' will be available in index.js with the method 'window.electron'
|
2022-08-17 08:07:50 +05:30
|
|
|
contextBridge.exposeInMainWorld("electron", {
|
|
|
|
send: (command, payload) => ipcRenderer.send(command, payload),
|
|
|
|
on: (command, func) =>
|
|
|
|
ipcRenderer.on(command, (event, args) => {
|
2022-08-17 17:06:19 +05:30
|
|
|
func(event, args);
|
2022-08-17 08:07:50 +05:30
|
|
|
}),
|
2022-08-17 14:48:49 +05:30
|
|
|
invoke: (command, payload) => ipcRenderer.invoke(command, payload),
|
2022-08-17 08:07:50 +05:30
|
|
|
});
|