feat: add <webview>.sendToFrame() / frameId to 'ipc-message' event (#30451)

This commit is contained in:
Milan Burda 2021-08-25 09:46:46 +02:00 committed by GitHub
parent be43996d35
commit 501ac15b1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 3 deletions

View file

@ -161,8 +161,12 @@ const createGuest = function (embedder: Electron.WebContents, embedderFrameId: n
});
// Dispatch guest's IPC messages to embedder.
guest.on('ipc-message-host' as any, function (_: Electron.Event, channel: string, args: any[]) {
sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT, 'ipc-message', { channel, args });
guest.on('ipc-message-host' as any, function (event: Electron.IpcMainEvent, channel: string, args: any[]) {
sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT, 'ipc-message', {
frameId: [event.processId, event.frameId],
channel,
args
});
});
// Notify guest of embedder window visibility when it is ready