IpcRenderer

external interface IpcRenderer : EventEmitter(source)

Functions

Link copied to clipboard
abstract external fun addListener(channel: String, listener: Function<Unit>)

Alias for ipcRenderer.on.

external fun addListener(type: EventType, listener: EventListener)
Link copied to clipboard
external fun emit(type: EventType, vararg args: Any?): Boolean
Link copied to clipboard
Link copied to clipboard
external fun getMaxListeners(): Double
Link copied to clipboard
abstract external fun invoke(channel: String, vararg args: Any?): Promise<Any?>

Resolves with the response from the main process.

Link copied to clipboard
external fun listenerCount(type: EventType, listener: EventListener): Double
Link copied to clipboard
Link copied to clipboard
abstract external fun off(channel: String, listener: Function<Unit>)

Removes the specified listener from the listener array for the specified channel.

external fun off(type: EventType, listener: EventListener)
Link copied to clipboard
abstract external fun on(channel: String, listener: Function<Unit>)

Listens to channel, when a new message arrives listener would be called with listener(event, args...).

external fun on(type: EventType, listener: EventListener)
Link copied to clipboard
abstract external fun once(channel: String, listener: Function<Unit>)

Adds a one time listener function for the event. This listener is invoked only the next time a message is sent to channel, after which it is removed.

external fun once(type: EventType, listener: EventListener)
Link copied to clipboard
abstract external fun postMessage(channel: String, message: Any?, transfer: ReadonlyArray<MessagePort> = definedExternally)

Send a message to the main process, optionally transferring ownership of zero or more MessagePort objects.

Link copied to clipboard
external fun prependListener(type: EventType, listener: EventListener)
Link copied to clipboard
external fun prependOnceListener(type: EventType, listener: EventListener)
Link copied to clipboard
Link copied to clipboard
abstract external fun removeAllListeners(channel: String = definedExternally)

Removes all listeners from the specified channel. Removes all listeners from all channels if no channel is specified.

external fun removeAllListeners(type: EventType)
Link copied to clipboard
abstract external fun removeListener(channel: String, listener: Function<Unit>)

Alias for ipcRenderer.off.

external fun removeListener(type: EventType, listener: EventListener)
Link copied to clipboard
abstract external fun send(channel: String, vararg args: Any?)

Send an asynchronous message to the main process via channel, along with arguments. Arguments will be serialized with the Structured Clone Algorithm, just like window.postMessage, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.

Link copied to clipboard
abstract external fun sendSync(channel: String, vararg args: Any?): Any?

The value sent back by the ipcMain handler.

Link copied to clipboard
abstract external fun sendToHost(channel: String, vararg args: Any?)

Like ipcRenderer.send but the event will be sent to the <webview> element in the host page instead of the main process.

Link copied to clipboard
external fun setMaxListeners(n: Number)