Skip to content

ElectronIpcMain.once method

ElectronIpcMain › once

Unofficial

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.

Signature:

once(channel: string, listener: (event: ElectronIpcMainEvent, ...args: unknown[]) => void): this

Parameters:

Parameter Type Description
channel string The IPC channel name.
listener (event: ElectronIpcMainEvent, ...args: unknown[]) => void Callback invoked when a message is received.

Returns: thisThis IpcMain instance.