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:

ParameterTypeDescription
channelstringThe IPC channel name.
listener(event: ElectronIpcMainEvent, ...args: unknown[]) => voidCallback invoked when a message is received.

Returns: thisThis IpcMain instance.