WebContentsView Type
⚠ Process Availability: Main ✔ | Renderer ❌ | Utility ❌ | Exported ✔
A View that displays a WebContents.Process: MainThis module cannot be used until the ready event of the app module is emitted.### Class: WebContentsView extends View> A View that displays a WebContents.Process: MainWebContentsView inherits from View.WebContentsView is an EventEmitter.> [!WARNING] Electron's built-in classes cannot be subclassed in user code. For more information, see the FAQ.
Constructors
| Constructor |
Description
|
Full Usage:
WebContentsView(?webPreferences, ?webContents)
Parameters:
WebPreferences
-
Settings of web page's features.
?webContents : WebContents
-
If present, the given WebContents will be adopted by the WebContentsView. A WebContents may only be presented in one
WebContentsView at a time.
Returns: WebContentsView
|
|
Instance members
| Instance member |
Description
|
|
If the same View is added to a parent which already contains it, it will be reordered such that it becomes the topmost view.
|
|
A View[] property representing the child views of this view.
|
|
The bounds of this View, relative to its parent.
|
Full Usage:
this.getVisible ()
Returns: bool
Modifiers: inline |
Whether the view should be drawn. Note that this is different from whether the view is visible on screen—it may still be obscured or out of view.
|
Full Usage:
this.offBoundsChanged handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the view's bounds have changed in response to being laid out. The new bounds can be retrieved with view.getBounds().
|
Full Usage:
this.onBoundsChanged handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the view's bounds have changed in response to being laid out. The new bounds can be retrieved with view.getBounds().
|
Full Usage:
this.onceBoundsChanged handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the view's bounds have changed in response to being laid out. The new bounds can be retrieved with view.getBounds().
|
|
If the view passed as a parameter is not a child of this view, this method is a no-op.
|
Full Usage:
this.setBackgroundColor color
Parameters:
string
Modifiers: inline |
Examples of valid color values:* Hex * #fff (RGB) * #ffff (ARGB) * #ffffff (RRGGBB) * ffffffff (AARRGGBB)* RGB * rgb(([\d]+),\s*([\d]+),\s*([\d]+)) * e.g. rgb(255, 255, 255)* RGBA * rgba(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+))
|
Full Usage:
this.setBorderRadius radius
Parameters:
int
Modifiers: inline |
|
|
|
Full Usage:
this.setVisible visible
Parameters:
bool
Modifiers: inline |
|
|
A WebContents property containing a reference to the displayed WebContents. Use this to interact with the WebContents, for instance to load a URL.
|
fable-electron-docs-api