feat: convert webContents primitives to properties (#18998)
* feat: convert webContents primitives to properties * address feedback from review
This commit is contained in:
parent
de072c6ef5
commit
8782d06ed6
9 changed files with 152 additions and 49 deletions
|
@ -4,11 +4,6 @@ The Electron team is currently undergoing an initiative to convert separate gett
|
|||
|
||||
## Candidates
|
||||
|
||||
* `app` module
|
||||
* `dock`
|
||||
* `badge`
|
||||
* `autoUpdater` module
|
||||
* `feedUrl`
|
||||
* `BrowserWindow`
|
||||
* `fullscreen`
|
||||
* `simpleFullscreen`
|
||||
|
@ -20,14 +15,6 @@ The Electron team is currently undergoing an initiative to convert separate gett
|
|||
* `visibleOnAllWorkspaces`
|
||||
* `crashReporter` module
|
||||
* `uploadToServer`
|
||||
* `Session` module
|
||||
* `preloads`
|
||||
* `webContents` module
|
||||
* `zoomFactor`
|
||||
* `zoomLevel`
|
||||
* `audioMuted`
|
||||
* `userAgent`
|
||||
* `frameRate`
|
||||
* `webFrame` modules
|
||||
* `zoomFactor`
|
||||
* `zoomLevel`
|
||||
|
@ -58,3 +45,9 @@ The Electron team is currently undergoing an initiative to convert separate gett
|
|||
* `isMacTemplateImage`
|
||||
* `SystemPreferences` module
|
||||
* `appLevelAppearance`
|
||||
* `webContents` module
|
||||
* `audioMuted`
|
||||
* `frameRate`
|
||||
* `userAgent`
|
||||
* `zoomFactor`
|
||||
* `zoomLevel`
|
||||
|
|
|
@ -979,10 +979,14 @@ Returns `Boolean` - Whether the renderer process has crashed.
|
|||
|
||||
Overrides the user agent for this web page.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.getUserAgent()`
|
||||
|
||||
Returns `String` - The user agent for this web page.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.insertCSS(css)`
|
||||
|
||||
* `css` String
|
||||
|
@ -1049,10 +1053,14 @@ Ignore application menu shortcuts while this web contents is focused.
|
|||
|
||||
Mute the audio on the current web page.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.isAudioMuted()`
|
||||
|
||||
Returns `Boolean` - Whether this page has been muted.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.isCurrentlyAudible()`
|
||||
|
||||
Returns `Boolean` - Whether audio is currently playing.
|
||||
|
@ -1064,10 +1072,14 @@ Returns `Boolean` - Whether audio is currently playing.
|
|||
Changes the zoom factor to the specified factor. Zoom factor is
|
||||
zoom percent divided by 100, so 300% = 3.0.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.getZoomFactor()`
|
||||
|
||||
Returns `Number` - the current zoom factor.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.setZoomLevel(level)`
|
||||
|
||||
* `level` Number - Zoom level.
|
||||
|
@ -1077,10 +1089,14 @@ increment above or below represents zooming 20% larger or smaller to default
|
|||
limits of 300% and 50% of original size, respectively. The formula for this is
|
||||
`scale := 1.2 ^ level`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.getZoomLevel()`
|
||||
|
||||
Returns `Number` - the current zoom level.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.setVisualZoomLevelLimits(minimumLevel, maximumLevel)`
|
||||
|
||||
* `minimumLevel` Number
|
||||
|
@ -1672,10 +1688,14 @@ Returns `Boolean` - If *offscreen rendering* is enabled returns whether it is cu
|
|||
If *offscreen rendering* is enabled sets the frame rate to the specified number.
|
||||
Only values between 1 and 60 are accepted.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.getFrameRate()`
|
||||
|
||||
Returns `Integer` - If *offscreen rendering* is enabled returns the current frame rate.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.invalidate()`
|
||||
|
||||
Schedules a full repaint of the window this web contents is in.
|
||||
|
@ -1740,6 +1760,33 @@ Returns `String` - the type of the webContent. Can be `backgroundPage`, `window`
|
|||
|
||||
### Instance Properties
|
||||
|
||||
#### `contents.audioMuted`
|
||||
|
||||
A `Boolean` property that determines whether this page is muted.
|
||||
|
||||
#### `contents.userAgent`
|
||||
|
||||
A `String` property that determines the user agent for this web page.
|
||||
|
||||
#### `contents.zoomLevel`
|
||||
|
||||
A `Number` property that determines the zoom level for this web contents.
|
||||
|
||||
The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. The formula for this is `scale := 1.2 ^ level`.
|
||||
|
||||
#### `contents.zoomFactor`
|
||||
|
||||
A `Number` property that determines the zoom factor for this web contents.
|
||||
|
||||
The zoom factor is the zoom percent divided by 100, so 300% = 3.0.
|
||||
|
||||
#### `contents.frameRate`
|
||||
|
||||
An `Integer` property that sets the frame rate of the web contents to the specified number.
|
||||
Only values between 1 and 60 are accepted.
|
||||
|
||||
Only applicable if *offscreen rendering* is enabled.
|
||||
|
||||
#### `contents.id`
|
||||
|
||||
A `Integer` representing the unique ID of this WebContents.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue