Emit attach params as well in event

This commit is contained in:
Kevin Sawicki 2017-02-03 13:58:07 -08:00
parent 792f3c3030
commit 8b0d3a2567
2 changed files with 5 additions and 2 deletions

View file

@ -511,8 +511,11 @@ Returns:
* `webPreferences` Object - The web preferences that will be used by the guest
page. This object can be modified to adjust the preferences for the guest
page.
* `params` Object - The other `<webview>` parameters such as the `src` URL.
This object can be modified to adjust the parameters of the guest page.
Calling `event.preventDefault()` will destroy the guest page.
Emitted when a `<webview>`'s web contents is being attached to this web
contents. Calling `event.preventDefault()` will destroy the guest page.
### Instance Methods

View file

@ -206,7 +206,7 @@ const attachGuest = function (event, elementInstanceId, guestInstanceId, params)
webPreferences.preloadURL = params.preload
}
event.sender.emit('will-attach-webview', event, guest, webPreferences)
event.sender.emit('will-attach-webview', event, guest, webPreferences, params)
if (event.defaultPrevented) {
if (guest.viewInstanceId == null) guest.viewInstanceId = params.instanceId
destroyGuest(embedder, guestInstanceId)