chrome.experimental.devtools.console
Description: |
Use the chrome.experimental.devtools.console API to retrieve messages from the inspected page console and post messages there.
|
Availability: |
Experimental only (see How to use experimental APIs).
|
Use chrome.experimental.devtools.console
to retrieve messages from
the inspected page console and post messages there. getMessages()
returns the list of messages on the console, onMessageAdded
event provides notifications on new messages, and addMessage()
allows an extension to add new messages.
Summary
Types | |
---|---|
ConsoleMessage | |
Severity | |
Methods | |
addMessage −
chrome.experimental.devtools.console.addMessage( Severity severity, string text)
| |
getMessages −
chrome.experimental.devtools.console.getMessages(function callback)
| |
Events | |
onMessageAdded |
Types
ConsoleMessage
properties | ||
---|---|---|
Severity | severity | Message severity. |
string | text | The text of the console message, as represented by the first argument to the console.log() or a similar method (no parameter substitution performed). |
string | (optional) url | The URL of the script that originated the message, if available. |
double | (optional) line | The number of the line where the message originated, if available. |
Severity
properties | ||
---|---|---|
string | Tip | |
string | Debug | |
string | Log | |
string | Warning | |
string | Error |
Methods
addMessage
chrome.experimental.devtools.console.addMessage( Severity severity, string text)
Adds a message to the console.
Parameters | ||
---|---|---|
Severity | severity | The severity of the message. |
string | text | The text of the message. |
getMessages
chrome.experimental.devtools.console.getMessages(function callback)
Retrieves console messages.
Parameters | |||||
---|---|---|---|---|---|
function | callback |
A function that receives console messages when the request completes.
The callback parameter should be a function that looks like this: function(array of ConsoleMessage messages) {...};
|
Events
onMessageAdded
Fired when a new message is added to the console.
addListener
chrome.experimental.devtools.console.onMessageAdded.addListener(function callback)
Parameters | |||||
---|---|---|---|---|---|
function | callback |
The callback parameter should be a function that looks like this: function( ConsoleMessage message) {...};
|