feat(core): add module scaffolding and provider registries

This commit is contained in:
kyasuda
2026-02-10 13:16:01 -08:00
committed by sudacode
parent 4a6735927f
commit 79b580e033
19 changed files with 822 additions and 0 deletions

27
src/ipc/renderer-api.ts Normal file
View File

@@ -0,0 +1,27 @@
import { ipcRenderer, IpcRendererEvent } from "electron";
import {
MainToRendererEventChannel,
RendererToMainInvokeChannel,
RendererToMainSendChannel,
} from "./contract";
export function invokeFromRenderer<T>(
channel: RendererToMainInvokeChannel,
...args: unknown[]
): Promise<T> {
return ipcRenderer.invoke(channel, ...args) as Promise<T>;
}
export function sendFromRenderer(
channel: RendererToMainSendChannel,
...args: unknown[]
): void {
ipcRenderer.send(channel, ...args);
}
export function onMainEvent(
channel: MainToRendererEventChannel,
listener: (event: IpcRendererEvent, ...args: unknown[]) => void,
): void {
ipcRenderer.on(channel, listener);
}