Skip to content

Instantly share code, notes, and snippets.

View benoitlahoz's full-sized avatar

Benoît LAHOZ benoitlahoz

View GitHub Profile
@benoitlahoz
benoitlahoz / 0_ipc-emit.ts
Last active May 26, 2024 09:19
IPC communication in Electron with client-side callback.
// Renderer.
/**
* Describes the function used to call `invoke` on ipcRenderer.
*/
type InvokeFn = (channel: string, ...args: any[]) => Promise<any>;
/**
* The `invoke` function returned by the `exposeInMainWorld` of the preload script
* or by `ipcRenderer` itself.