Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 871 Bytes

message-channel-main.md

File metadata and controls

30 lines (20 loc) · 871 Bytes

MessageChannelMain

MessageChannelMain is the main-process-side equivalent of the DOM MessageChannel object. Its singular function is to create a pair of connected MessagePortMain objects.

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

Class: MessageChannelMain

Example:

const { port1, port2 } = new MessageChannelMain()
w.webContents.postMessage('port', null, [port2])
port1.postMessage({ some: 'message' })

Instance Properties

channel.port1

A MessagePortMain property.

channel.port2

A MessagePortMain property.