feat: webContents.loadURL returns a promise (#15855)
This commit is contained in:
parent
1b8c11121f
commit
442c1b22e3
6 changed files with 180 additions and 13 deletions
|
@ -697,6 +697,11 @@ Custom value can be returned by setting `event.returnValue`.
|
|||
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md) | [UploadBlob[]](structures/upload-blob.md)) (optional)
|
||||
* `baseURLForDataURL` String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified `url` is a data url and needs to load other files.
|
||||
|
||||
Returns `Promise<void>` - the promise will resolve when the page has finished loading
|
||||
(see [`did-finish-load`](web-contents.md#event-did-finish-load)), and rejects
|
||||
if the page fails to load (see
|
||||
[`did-fail-load`](web-contents.md#event-did-fail-load)).
|
||||
|
||||
Loads the `url` in the window. The `url` must contain the protocol prefix,
|
||||
e.g. the `http://` or `file://`. If the load should bypass http cache then
|
||||
use the `pragma` header to achieve it.
|
||||
|
@ -715,6 +720,10 @@ webContents.loadURL('https://github.com', options)
|
|||
* `search` String (optional) - Passed to `url.format()`.
|
||||
* `hash` String (optional) - Passed to `url.format()`.
|
||||
|
||||
Returns `Promise<void>` - the promise will resolve when the page has finished loading
|
||||
(see [`did-finish-load`](web-contents.md#event-did-finish-load)), and rejects
|
||||
if the page fails to load (see [`did-fail-load`](web-contents.md#event-did-fail-load)).
|
||||
|
||||
Loads the given file in the window, `filePath` should be a path to
|
||||
an HTML file relative to the root of your application. For instance
|
||||
an app structure like this:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue