feat: add event.senderId property to IPCs sent via ipcRenderer.sendTo (#14395)

This commit is contained in:
Milan Burda 2018-09-01 03:13:51 +02:00 committed by Charles Kerr
parent b89848d683
commit c17a1b37ea
11 changed files with 90 additions and 31 deletions

View file

@ -89,3 +89,17 @@ Sends a message to a window with `windowid` via `channel`.
Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in
the host page instead of the main process.
## Event object
The `event` object passed to the `callback` has the following methods:
### `event.senderId`
Returns the `webContents.id` that sent the message, you can call
`event.sender.sendTo(event.senderId, ...)` to reply to the message, see
[ipcRenderer.sendTo][ipc-renderer-sendto] for more information.
This only applies to messages sent from a different renderer.
Messages sent directly from the main process set `event.senderId` to `0`.
[ipc-renderer-sendto]: #ipcrenderersendtowindowid-channel--arg1-arg2-