feat: expose frame & move properties to console-message event object (#43617)
* feat: expose frame on console-message event refactor: use property names similar to ServiceWorker's console-message event refactor: don't use deprecated params in tests doc: console-message breaking change chore: add deprecation warning docs: restore deprecated argument descriptions * move console-message deprecations to v34 --------- Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
parent
35aeab6ecd
commit
87bd665e41
13 changed files with 140 additions and 65 deletions
|
@ -955,11 +955,17 @@ Emitted when a `<webview>` has been attached to this web contents.
|
|||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `level` Integer - The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and `error`.
|
||||
* `message` string - The actual console message
|
||||
* `line` Integer - The line number of the source that triggered this console message
|
||||
* `sourceId` string
|
||||
* `details` Event\<\>
|
||||
* `message` string - Message text
|
||||
* `level` string - Message severity
|
||||
Possible values include `info`, `warning`, `error`, and `debug`.
|
||||
* `lineNumber` Integer - Line number in the log source
|
||||
* `sourceId` string - URL of the log source
|
||||
* `frame` WebFrameMain - Frame that logged the message
|
||||
* `level` Integer _Deprecated_ - The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and `error`.
|
||||
* `message` string _Deprecated_ - The actual console message
|
||||
* `line` Integer _Deprecated_ - The line number of the source that triggered this console message
|
||||
* `sourceId` string _Deprecated_
|
||||
|
||||
Emitted when the associated window logs a console message.
|
||||
|
||||
|
|
|
@ -12,6 +12,23 @@ This document uses the following convention to categorize breaking changes:
|
|||
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
|
||||
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
|
||||
|
||||
## Planned Breaking API Changes (34.0)
|
||||
|
||||
### Deprecated: `level`, `message`, `line`, and `sourceId` arguments in `console-message` event on `WebContents`
|
||||
|
||||
The `console-message` event on `WebContents` has been updated to provide details on the `Event`
|
||||
argument.
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
webContents.on('console-message', (event, level, message, line, sourceId) => {})
|
||||
|
||||
// Replace with:
|
||||
webContents.on('console-message', ({ level, message, lineNumber, sourceId, frame }) => {})
|
||||
```
|
||||
|
||||
Additionally, `level` is now a string with possible values of `info`, `warning`, `error`, and `debug`.
|
||||
|
||||
## Planned Breaking API Changes (33.0)
|
||||
|
||||
### Behavior Changed: frame properties may retrieve detached WebFrameMain instances or none at all
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue