An ExtensionPanel
represents a panel added to the devtools. It's the resolution of the Promise
returned by browser.devtools.panels.create()
.
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).Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
onHidden |
Yes |
79 |
54 |
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
onSearch |
Yes |
79 |
No |
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
onShown |
Yes |
79 |
54 |
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
This code creates a new panel, then adds handlers for its onShown
and onHidden
events.
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.
Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/devtools/panels/ExtensionPanel