ElectronIpcRenderer.invoke method
ElectronIpcRenderer › invoke
Unofficial
Sends a message to the main process viachannel and expects a result asynchronously.The main process should listen for
channel with ipcMain.handle(). Arguments are serialized with the Structured Clone Algorithm, so prototype chains are not included and sending functions, promises, symbols, weak maps, or weak sets throws an exception. Signature:
invoke(channel: string, args?: unknown[]): Promise<unknown>Parameters:
| Parameter | Type | Description |
|---|---|---|
| channel | string | The IPC channel name. |
| args? | unknown[] | Arguments to send. |
Returns: Promise<unknown> — A promise resolving with the response from the main process.