mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
feat: make async webContents / <webview> methods return a Promise (#18792)
This commit is contained in:
committed by
Alexey Kuzmin
parent
632bbf948d
commit
deebde66f9
@@ -379,6 +379,8 @@ Returns `String` - The user agent for guest page.
|
||||
|
||||
* `css` String
|
||||
|
||||
Returns `Promise<void>`
|
||||
|
||||
Injects CSS into the guest page.
|
||||
|
||||
### `<webview>.executeJavaScript(code[, userGesture])`
|
||||
@@ -490,6 +492,8 @@ Executes editing command `replaceMisspelling` in page.
|
||||
|
||||
* `text` String
|
||||
|
||||
Returns `Promise<void>`
|
||||
|
||||
Inserts `text` to the focused element.
|
||||
|
||||
### `<webview>.findInPage(text[, options])`
|
||||
@@ -531,6 +535,8 @@ Stops any `findInPage` request for the `webview` with the provided `action`.
|
||||
the web page. Default is `false`.
|
||||
* `deviceName` String (optional) - Set the printer device name to use. Default is `''`.
|
||||
|
||||
Returns `Promise<void>`
|
||||
|
||||
Prints `webview`'s web page. Same as `webContents.print([options])`.
|
||||
|
||||
### `<webview>.printToPDF(options)`
|
||||
@@ -562,6 +568,8 @@ Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
|
||||
* `channel` String
|
||||
* `...args` any[]
|
||||
|
||||
Returns `Promise<void>`
|
||||
|
||||
Send an asynchronous message to renderer process via `channel`, you can also
|
||||
send arbitrary arguments. The renderer process can handle the message by
|
||||
listening to the `channel` event with the [`ipcRenderer`](ipc-renderer.md) module.
|
||||
@@ -573,6 +581,8 @@ examples.
|
||||
|
||||
* `event` Object
|
||||
|
||||
Returns `Promise<void>`
|
||||
|
||||
Sends an input `event` to the page.
|
||||
|
||||
See [webContents.sendInputEvent](web-contents.md#contentssendinputeventevent)
|
||||
@@ -607,6 +617,8 @@ Returns `Number` - the current zoom level.
|
||||
* `minimumLevel` Number
|
||||
* `maximumLevel` Number
|
||||
|
||||
Returns `Promise<void>`
|
||||
|
||||
Sets the maximum and minimum pinch-to-zoom level.
|
||||
|
||||
### `<webview>.setLayoutZoomLevelLimits(minimumLevel, maximumLevel)`
|
||||
@@ -614,6 +626,8 @@ Sets the maximum and minimum pinch-to-zoom level.
|
||||
* `minimumLevel` Number
|
||||
* `maximumLevel` Number
|
||||
|
||||
Returns `Promise<void>`
|
||||
|
||||
Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
|
||||
|
||||
### `<webview>.showDefinitionForSelection()` _macOS_
|
||||
|
||||
Reference in New Issue
Block a user