docs.rodeo

MDN Web Docs mirror

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.

Examples

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);
  });

{{WebExtExamples}} 

Browser compatibility

{{Compat}} 

[!NOTE] This API is based on Chromium’s chrome.devtools.panels API.

In this article

View on MDN