import { contextBridge, ipcRenderer } from "electron"; import { CH, type Api, type ProcessInfo, type UtilityResult, } from "../shared/ipc"; const api: Api = { info: (): Promise => ipcRenderer.invoke(CH.info), crashRenderer: (): Promise<{ ok: boolean }> => ipcRenderer.invoke(CH.crash), runUtility: (n: number): Promise => ipcRenderer.invoke(CH.utility, n), }; contextBridge.exposeInMainWorld("api", api);