M0-M11 狩夜人笔记初始实现:11里程碑+86测试

This commit is contained in:
hunter-dev
2026-08-24 20:35:22 +08:00
commit 3ebd33536b
106 changed files with 10490 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
// 渲染层 IPC 调用封装:类型安全,禁止接触绝对路径
import type { BridgeApi, IpcMap } from '@hunter/shared';
declare global { interface Window { dsh?: BridgeApi } }
function getBridge(): BridgeApi {
if (!window.dsh) throw new Error('IPC bridge 未就绪:window.dsh 不存在(preload 可能未加载)');
return window.dsh;
}
export const invoke: BridgeApi['invoke'] = (channel, args) => getBridge().invoke(channel, args as never) as Promise<never>;
export const send: BridgeApi['send'] = (channel, args) => getBridge().send(channel, args as never);