Files
pqs-9100_client/electron/preload/bridge.js

14 lines
494 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 如果启用了上下文隔离渲染进程无法使用electron的api
* 可通过contextBridge 导出api给渲染进程使用
*/
const { contextBridge, ipcRenderer } = require('electron')
contextBridge.exposeInMainWorld('electron', {
ipcRenderer: ipcRenderer,
// 日志窗口控制
showLogWindow: () => ipcRenderer.invoke('show-log-window'),
hideLogWindow: () => ipcRenderer.invoke('hide-log-window'),
toggleLogWindow: () => ipcRenderer.invoke('toggle-log-window'),
})