Merge branch 'main' of github.com:electron-vite/electron-vite-vue into main

This commit is contained in:
Leo Wang(草鞋没号) 2024-04-18 17:36:57 +08:00
commit 7d5708d600

View File

@ -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.