(
event: EventType,
listener: (
event: Electron.IpcMainInvokeEvent,
data: T,
) => unknown | Promise<unknown>,
)
| 25 | * @param listener - Callback whose return value is sent back to the renderer. |
| 26 | */ |
| 27 | export function handleMainEvent<T = EventData>( |
| 28 | event: EventType, |
| 29 | listener: ( |
| 30 | event: Electron.IpcMainInvokeEvent, |
| 31 | data: T, |
| 32 | ) => unknown | Promise<unknown>, |
| 33 | ) { |
| 34 | ipcMain.handle(event, listener as Parameters<typeof ipcMain.handle>[1]); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Push an event from the main process to the renderer via webContents. |
no outgoing calls
no test coverage detected