Skip to content

ElectronMessagePortMain.on('close') method

ElectronMessagePortMain › on(‘close’)

Unofficial

Registers a listener for the close event, emitted when the remote end becomes disconnected.

Signature:

on(event: "close", listener: () => void): this

Parameters:

ParameterTypeDescription
event"close"The event name.
listener() => voidCalled when the port closes.

Returns: thisThis message port instance.