mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-16 22:38:31 +02:00
25 lines
516 B
JavaScript
25 lines
516 B
JavaScript
/**
|
|
This script is run whenever the devtools are open.
|
|
In here, we can create our panel.
|
|
*/
|
|
|
|
function handleShown() {
|
|
console.log("panel is being shown");
|
|
}
|
|
|
|
function handleHidden() {
|
|
console.log("panel is being hidden");
|
|
}
|
|
|
|
/**
|
|
Create a panel, and add listeners for panel show/hide events.
|
|
*/
|
|
browser.devtools.panels.create(
|
|
"My Panel",
|
|
"/icons/star.png",
|
|
"/devtools/panel/panel.html"
|
|
).then((newPanel) => {
|
|
newPanel.onShown.addListener(handleShown);
|
|
newPanel.onHidden.addListener(handleHidden);
|
|
});
|