// // 在 preload 脚本中。 const { ipcRenderer } = require('electron') window.electron = { // 设置窗口大小 setMainWindowSize: (config) => { ipcRenderer.invoke('setMainWindowSize', { ...config }) }, // 获取窗口大小 getWindowSize: (config) => { return ipcRenderer.invoke('getWindowSize') }, // 设置窗口状态 setViewStatus: (status) => { ipcRenderer.invoke('setViewStatus', status) }, // 获取当前是否全屏 getIsMaximized: () => { return ipcRenderer.invoke('getIsMaximized') }, // 获取版本号 getVersion: () => { return ipcRenderer.invoke('getVersion') }, // 获取共享屏幕列表 getSources: () => { return ipcRenderer.invoke('getSources') }, // 复制文字 setWriteText: (text) => { return ipcRenderer.invoke('setWriteText', text) }, // 加入房间通知 joinNotification: (user) => { ipcRenderer.invoke('joinNotification', user) }, // 监听退出 onQuit: (callback) => { ipcRenderer.on('onQuit', callback) }, // 退出房间 quit: () => { return ipcRenderer.invoke('quit') }, // 监听更新 onUpdate: (callback) => { ipcRenderer.on('update', callback) }, // 执行退出房间 quitAndInstall: (callback) => { ipcRenderer.on('quitAndInstall', callback) }, // 通知下载最新的包 onDownload: (type) => { ipcRenderer.invoke('updateDownload', type) }, // 选择文件夹 selectFilePath: (data) => { ipcRenderer.invoke('selectFilePath', data) }, // 发送文件夹路径 onFilePath: (callback) => { ipcRenderer.on('onFilePath', callback) }, // 下载文件 downFile: (callback) => { ipcRenderer.on('downFile', callback) } }