1 parent
eca6b6800e
commit
6cd6bb5353
1 file changed
+4
-4
@@ -4,19 +4,19 @@ import { ipcRenderer, contextBridge } from 'electron'
|
|||||||
contextBridge.exposeInMainWorld('ipcRenderer', {
|
contextBridge.exposeInMainWorld('ipcRenderer', {
|
||||||
on(...args: Parameters<typeof ipcRenderer.on>) {
|
on(...args: Parameters<typeof ipcRenderer.on>) {
|
||||||
const [channel, listener] = args
|
const [channel, listener] = args
|
||||||
ipcRenderer.on(channel, (event, ...args) => listener(event, ...args))
|
return ipcRenderer.on(channel, (event, ...args) => listener(event, ...args))
|
||||||
},
|
},
|
||||||
off(...args: Parameters<typeof ipcRenderer.off>) {
|
off(...args: Parameters<typeof ipcRenderer.off>) {
|
||||||
const [channel, ...omit] = args
|
const [channel, ...omit] = args
|
||||||
ipcRenderer.off(channel, ...omit)
|
return ipcRenderer.off(channel, ...omit)
|
||||||
},
|
},
|
||||||
send(...args: Parameters<typeof ipcRenderer.send>) {
|
send(...args: Parameters<typeof ipcRenderer.send>) {
|
||||||
const [channel, ...omit] = args
|
const [channel, ...omit] = args
|
||||||
ipcRenderer.send(channel, ...omit)
|
return ipcRenderer.send(channel, ...omit)
|
||||||
},
|
},
|
||||||
invoke(...args: Parameters<typeof ipcRenderer.invoke>) {
|
invoke(...args: Parameters<typeof ipcRenderer.invoke>) {
|
||||||
const [channel, ...omit] = args
|
const [channel, ...omit] = args
|
||||||
ipcRenderer.invoke(channel, ...omit)
|
return ipcRenderer.invoke(channel, ...omit)
|
||||||
},
|
},
|
||||||
|
|
||||||
// You can expose other APTs you need here.
|
// You can expose other APTs you need here.
|
||||||
|
|||||||
Reference in new issue
Block a user