Browse Source

Emit attach params as well in event

Kevin Sawicki 8 years ago
parent
commit
8b0d3a2567
2 changed files with 5 additions and 2 deletions
  1. 4 1
      docs/api/web-contents.md
  2. 1 1
      lib/browser/guest-view-manager.js

+ 4 - 1
docs/api/web-contents.md

@@ -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
 

+ 1 - 1
lib/browser/guest-view-manager.js

@@ -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)