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 contents.ipc (EventEmitter), which allows handling messages for given webContents #16420
Conversation
…ges for given instance
contents.ipc
: EventEmitter
, which allows handling messages for given instanceThere 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.
👍
Tests maybe?
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.
IMO this just adds another route to do the same stuff you can already do. In particular something I think was overlooked here was the ipc-message
event.
webContents.on('ipc-message', handler)
I don't think adding another source of events is a good design choice here. Should discuss the advantage of this comparing to the above ipc-message
event.
@MarshallOfSound |
@MarshallOfSound also you would have to handle |
@MarshallOfSound it actually seems like the code around |
@nornagon, @zcbenz, @codebytere what do you think? |
I agree with @MarshallOfSound that this seems like what the |
@nornagon, @MarshallOfSound fair enough. I will create a new PR to make the |
Replaced by #16468 |
Description of Change
webContents
instance are being handled.once
, where doing theevent.sender === someWebContents
check can't be done in the listener, as it would be unregistered even if we don't handle the message.webContents
directly as it could clash with existing events.webContents.ipc.removeAllListeners()
, which is safe(r) unlikeipcMain.removeAllListeners()
example
Checklist
npm test
passesRelease Notes
Notes: Added
contents.ipc
(EventEmitter
), which allows handling messages for givenwebContents