devtools.panels.ExtensionSidebarPane.setObject()
Displays a JSON object in the extension's sidebar pane.
The object is displayed as an expandable tree, as in the JSON viewer in Firefox. You can optionally specify a rootTitle
string: this will be displayed as the title of the tree's root.
This is an asynchronous function that returns a Promise
.
Syntax
var setting = browser.devtools.panels.setObject(
jsonObject, // string, array, or JSON object
rootTitle // string
)
Parameters
Return value
A Promise
that will be fulfilled with no arguments, once the object has been set.
Browser compatibility
Report problems with this compatibility data on GitHubwebextensions-desktop | webextensions-mobile | |||||
---|---|---|---|---|---|---|
setObject | ChromeFull supportYes
| EdgeFull support79
| FirefoxFull support57
| OperaFull supportYes | SafariNo supportNo | Firefox for AndroidNo supportNo |
Legend
- Full support
- Full support
- No support
- No support
- See implementation notes.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Examples
Create a new pane, and populate it with a JSON object. You could run this code in a script loaded by your extension's devtools page.
function onCreated(sidebarPane) {
sidebarPane.setObject({
someBool: true,
someString: "hello there",
someObject: {
someNumber: 42,
someOtherString: "this is my pane's content"
}
});
}
browser.devtools.panels.elements.createSidebarPane("My pane").then(onCreated);
Acknowledgements
This API is based on Chromium's chrome.devtools.panels
API.