Files
SubMiner/src/ipc/main-api.ts

20 lines
518 B
TypeScript

import { ipcMain, IpcMainEvent } from "electron";
import {
RendererToMainInvokeChannel,
RendererToMainSendChannel,
} from "./contract";
export function onRendererSend(
channel: RendererToMainSendChannel,
listener: (event: IpcMainEvent, ...args: any[]) => void,
): void {
ipcMain.on(channel, listener);
}
export function handleRendererInvoke(
channel: RendererToMainInvokeChannel,
handler: (event: Electron.IpcMainInvokeEvent, ...args: any[]) => unknown,
): void {
ipcMain.handle(channel, handler);
}