'init'
This commit is contained in:
18
lib/preload/api.ts
Normal file
18
lib/preload/api.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user