28 lines
743 B
JavaScript
28 lines
743 B
JavaScript
// // 在 preload 脚本中。
|
|
const { ipcRenderer } = require('electron')
|
|
window.electron = {
|
|
// 设置窗口大小
|
|
setMainWindowSize: (config) => {
|
|
ipcRenderer.invoke('setMainWindowSize', { ...config })
|
|
},
|
|
// 设置窗口状态
|
|
setViewStatus: (status) => {
|
|
ipcRenderer.invoke('setViewStatus', status)
|
|
},
|
|
// 获取当前是否全屏
|
|
getIsMaximized: () => {
|
|
return ipcRenderer.invoke('getIsMaximized')
|
|
},
|
|
// 复制文字
|
|
setWriteText: (text) => {
|
|
return ipcRenderer.invoke('setWriteText', text)
|
|
},
|
|
// 加入房间通知
|
|
joinNotification: (user) => {
|
|
ipcRenderer.invoke('joinNotification', user)
|
|
},
|
|
// 打开新页面
|
|
openNewPage: (url) => {
|
|
ipcRenderer.invoke('openNewPage', url)
|
|
}
|
|
} |