electron/docs/api/message-channel-main.md
Samuel Attard 1d158399a6
feat: expose the sameSite value for cookies (#22789)
* feat: expose the sameSite value for cookies

* Apply suggestions from code review

Co-Authored-By: Charles Kerr <ckerr@github.com>

* Apply suggestions from code review

Align with cookie samesite values for the extensions API

https://developer.chrome.com/extensions/cookies#type-SameSiteStatus

* chore: add tests for sameSite cookies get/set

* chore: update docs parser

* chore: update docs for MessageChannel and MessagePort to have correct process information

* chore: remove LOG warning

* chore: throw error if the string->samesite conversion fails

Co-authored-by: Charles Kerr <ckerr@github.com>
2020-04-02 11:28:43 -07:00

32 lines
917 B
Markdown

# MessageChannelMain
`MessageChannelMain` is the main-process-side equivalent of the DOM
[`MessageChannel`][] object. Its singular function is to create a pair of
connected [`MessagePortMain`](message-port-main.md) objects.
See the [Channel Messaging API][] documentation for more information on using
channel messaging.
## Class: MessageChannelMain
Process: [Main](../glossary.md#main-process)
Example:
```js
const { port1, port2 } = new MessageChannelMain()
w.webContents.postMessage('port', null, [port2])
port1.postMessage({ some: 'message' })
```
### Instance Properties
#### `channel.port1`
A [`MessagePortMain`](message-port-main.md) property.
#### `channel.port2`
A [`MessagePortMain`](message-port-main.md) property.
[`MessageChannel`]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel
[Channel Messaging API]: https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API