ElectronIpcMain
Unofficial
Electron IPC main for communicating with renderer processes from the main process.
Import:
import type { ElectronIpcMain } from '@obsidian-typings/obsidian-public-latest';Signature:
export interface ElectronIpcMain extends NodeJS.EventEmitterExtends: NodeJS.EventEmitter
Methods
| Method | Returns | Description | |
|---|---|---|---|
| handle(channel, listener) | void | Adds a handler for an invokeable IPC. This handler is called whenever a renderer calls ipcRenderer.invoke(channel, ...args).If listener returns a Promise, the eventual result of the promise is returned as a reply to the remote caller. Otherwise, the return value of the listener is used as the value of the reply.The event passed as the first argument to the handler is the same as that passed to a regular event listener. It includes information about which WebContents is the source of the invoke request. | |
| handleOnce(channel, listener) | void | Handles a single invokeable IPC message, then removes the listener. See ipcMain.handle(channel, listener). | |
| on(channel, listener) | this | Listens to channel; when a new message arrives listener is called with listener(event, args...). | |
| once(channel, listener) | this | Adds a one-time listener function for the event, invoked only the next time a message is sent to channel, after which it is removed. | |
| removeAllListeners(channel?) | this | Removes listeners of the specified channel. | |
| removeHandler(channel) | void | Removes any handler for channel, if present. | |
| removeListener(channel, listener) | this | Removes the specified listener from the listener array for the specified channel. |
Links to this page: