Skip to content

Reusable JPM package which provides the show/hide events for the dev/panel module

License

Notifications You must be signed in to change notification settings

rpl/firefox-devpanel-visibility-events-workaround

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

firefox-devpanel-visibility-events-workaround

This repo contains an npm package which can be used as a dependency in a Firefox Addon based on the Addon SDK and built with the jpm tool.

The goal of this module is to workaround the missing visibility events on the "dev/panel" Addon SDK module.

Usage

In your SDK addon, install the package as a dependency:

$ npm install --save rpl/firefox-devpanel-visibility-events-workaround

and integrate it into your Panel class:

const { DevPanelVisibilityListener } = require("devpanel-visibility-listener");

const panelVisibilityListener = new DevPanelVisibilityListener();

const DemoPanel = Class({
  extends: Panel,
  label: "DemoPanel",
  tooltip: "Demo Panel",
  icon: "./icon.png",
  url: "./index.html",
  setup: function({debuggee}) {
    ...
    // Watch the panel for its visibility events.
    panelVisibilityListener.addPanel(this);
  },
  dispose: function() {
    // Do not watch the panel for its visibility events anymore.
    panelVisibilityListener.removePanel(this);
    delete this.debuggee;
  },
  onReady: function() {
    ...
  },
  onShow: function() {
    console.log("ON SHOW");
  },
  onHide: function() {
    console.log("ON HIDE");
  }
});

About

Reusable JPM package which provides the show/hide events for the dev/panel module

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published