New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add webFrameMain.send() / webFrameMain.postMessage() #26807
Conversation
6d0e7ef
to
91d6bee
Compare
2f216a6
to
96bb921
Compare
96bb921
to
1393ecd
Compare
1393ecd
to
ac4bc26
Compare
d7287e7
to
534655b
Compare
This comment has been minimized.
This comment has been minimized.
534655b
to
04ac5fb
Compare
5e196ed
to
c3e8d09
Compare
c3e8d09
to
c88b36e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
const [port] = e.ports | ||
// ... | ||
}) | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ this
Is that what I need to do?
Sent from my Metro By T-Mobile 4G LTE Android Device
-------- Original message --------
From: Samuel Maddock <notifications@github.com>
Date: 1/8/21 12:20 PM (GMT-06:00)
To: electron/electron <electron@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
Subject: Re: [electron/electron] feat: add webFrameMain.send() / webFrameMain.postMessage() (#26807)
@samuelmaddock approved this pull request.
👍
________________________________
In docs/api/web-frame-main.md<#26807 (comment)>:
+process by accessing the `ports` property of the emitted event. When they
+arrive in the renderer, they will be native DOM `MessagePort` objects.
+
+For example:
+
+```js
+// Main process
+const { port1, port2 } = new MessageChannelMain()
+webContents.mainFrame.postMessage('port', { message: 'hello' }, [port1])
+
+// Renderer process
+ipcRenderer.on('port', (e, msg) => {
+ const [port] = e.ports
+ // ...
+})
+```
❤️ this
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#26807 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ASMU2B3H2RA6F4NM73DMAKLSY5EIDANCNFSM4ULJ6UXQ>.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
Release Notes Persisted
|
I was unable to backport this PR to "12-x-y" cleanly; |
Description of Change
Add
webFrameMain.send()
/webFrameMain.postMessage()
.Checklist
npm test
passesRelease Notes
Notes: Added
webFrameMain.send()
/webFrameMain.postMessage()
.