1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-16 19:57:19 +01:00
upscayl/electron/preload.ts
2022-11-12 02:17:00 +05:30

13 lines
489 B
TypeScript

import { ipcRenderer, contextBridge } from "electron";
// 'ipcRenderer' will be available in index.js with the method 'window.electron'
contextBridge.exposeInMainWorld("electron", {
send: (command: string, payload: any) => ipcRenderer.send(command, payload),
on: (command: string, func: (...args: any) => any) =>
ipcRenderer.on(command, (event, args) => {
func(event, args);
}),
invoke: (command: string, payload: any) =>
ipcRenderer.invoke(command, payload),
});