devtools.panels.ExtensionPanel
An ExtensionPanel
represents a panel added to the devtools. It's the resolution of the Promise
returned by browser.devtools.panels.create()
.
Type
Values of this type are objects. The define two events, onShown
and onHidden
.
onShown
is emitted when the panel is shown in the devtools (for example, because the user clicked on the panel's tab in the devtools window).onHidden
is emitted when the panel is hidden (for example, because the user switched to a different tab in the devtools window).
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
ExtensionPanel | |||||||
createStatusBarButton | |||||||
onHidden | |||||||
onSearch | |||||||
onShown |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
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
This code creates a new panel, then adds handlers for its onShown
and onHidden
events.
js
function handleShown(e) {
console.log(e);
console.log("panel is being shown");
}
function handleHidden(e) {
console.log(e);
console.log("panel is being hidden");
}
browser.devtools.panels
.create(
"My Panel", // title
"icons/star.png", // icon
"devtools/panel/panel.html", // content
)
.then((newPanel) => {
newPanel.onShown.addListener(handleShown);
newPanel.onHidden.addListener(handleHidden);
});
Note:
This API is based on Chromium's chrome.devtools.panels
API.