Files
desktop/lib/preload/api.ts
rosetta 83f38dc63f 'init'
2026-01-30 05:01:05 +02:00

18 lines
499 B
TypeScript

import { ipcRenderer } from 'electron';
const api = {
send: (channel: string, ...args: any[]) => {
ipcRenderer.send(channel, ...args);
},
receive: (channel: string, func: (...args: any[]) => void) => {
ipcRenderer.on(channel, (_, ...args) => func(...args));
},
invoke: (channel: string, ...args: any[]) => {
return ipcRenderer.invoke(channel, ...args);
},
removeAllListeners: (channel: string) => {
ipcRenderer.removeAllListeners(channel);
},
};
export default api;