This commit is contained in:
贾同学
2025-10-16 20:01:57 +08:00
commit 4768ef2d26
79 changed files with 3358 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
/*
* 如果启用了上下文隔离渲染进程无法使用electron的api
* 可通过contextBridge 导出api给渲染进程使用
*/
import { type IpcRenderer, contextBridge, ipcRenderer } from 'electron';
// 确保contextBridge.exposeInMainWorld的参数类型正确这里进行简单的类型定义示例
type ElectronApi = {
ipcRenderer: IpcRenderer;
};
const ele: ElectronApi = {
ipcRenderer,
};
contextBridge.exposeInMainWorld('electron', ele);