chore: 完善注释,添加 JSDoc
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { contextBridge, ipcRenderer } from 'electron';
|
||||
import { electronAPI } from '@electron-toolkit/preload';
|
||||
|
||||
// Custom APIs for renderer
|
||||
/**
|
||||
* 渲染进程可调用的自定义 API
|
||||
* 封装了所有与主进程通信的 IPC 调用及事件监听
|
||||
*/
|
||||
const api = {
|
||||
|
||||
// 服务器管理
|
||||
@@ -64,9 +67,7 @@ const api = {
|
||||
|
||||
};
|
||||
|
||||
// Use `contextBridge` APIs to expose Electron APIs to
|
||||
// renderer only if context isolation is enabled, otherwise
|
||||
// just add to the DOM global.
|
||||
// 根据是否启用上下文隔离,使用 contextBridge 暴露 API 或挂载到 window
|
||||
if (process.contextIsolated) {
|
||||
try {
|
||||
contextBridge.exposeInMainWorld('electron', electronAPI);
|
||||
|
||||
Reference in New Issue
Block a user