M0-M11 狩夜人笔记初始实现:11里程碑+86测试
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user