mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-28 06:22:45 -08:00
20 lines
518 B
TypeScript
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);
|
|
}
|