MessagePortMain

    See the Channel Messaging API documentation for more information on using channel messaging.

    MessagePortMain is an [EventEmitter][event-emitter].

    Process:
    This class is not exported from the 'electron' module. It is only available as a return value of other methods in the Electron API.

    • message any
    • transfer MessagePortMain[] (optional)

    Sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.

    port.start()

    port.close()

    Disconnects the port, so it is no longer active.

    Instance Events

    Event: ‘message’

    Returns:

    • messageEvent Object
      • ports MessagePortMain[]

    Event: ‘close’

    Emitted when the remote end of a MessagePortMain object becomes disconnected.