Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

392 B
Raw Blame
import type { IpcRenderer } from 'electron';
import type { RequestChannels } from './ipc-channels.ts';

export function createInvoker(ipc: IpcRenderer) {
  return <K extends keyof RequestChannels>(
    channel: K,
    ...args: RequestChannels[K]['args']
  ): Promise<RequestChannels[K]['result']> => ipc.invoke(channel, ...args);
}

export type IpcInvoker = ReturnType<typeof createInvoker>;