Labs/Jetpack/FlightDeck/Development Docs/AddonBuilderHelperIntegration

From MozillaWiki
< Labs‎ | Jetpack‎ | FlightDeck
Revision as of 14:05, 11 August 2010 by Zalun (talk | contribs) (Created page with "{{draft|}} FD needs to talk to Add-on Builder Helper extension. It uses its API to #install add-on #uninstall add-on #check if Helper is installed #listen to document.body.addo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Draft-template-image.png THIS PAGE IS A WORKING DRAFT Pencil-emoji U270F-gray.png
The page may be difficult to navigate, and some information on its subject might be incomplete and/or evolving rapidly.
If you have any questions or ideas, please add them as a new topic on the discussion page.

FD needs to talk to Add-on Builder Helper extension. It uses its API to

  1. install add-on
  2. uninstall add-on
  3. check if Helper is installed
  4. listen to document.body.addonbuilderhelperstart

Installing Add-ons

If the Helper is installed hitting Test should simply install add-on

 if (window.mozFlightDeck) {
   FD->createXPI
   FD->downloadXPI
   window.mozFlightDeck.send({cmd:"install",contents: downloadedXPI})
 }

Else display the warning with ability to install the Helper. Listen for the event fired after its installation and try to install add-on again. The listening for the event should be cancelled after some time or after certain action.

 if (!window.mozFlightDeck) {
   FD->displayWarning
   // listen for the event
   $(document.body).addEvent('addonbuilderhelperstart', FD->installAddOn);
   // stop listening after some time
   (function() {
     $(document.body).removeEvents('addonbuilderhelperstart');
    }).delay(someTime);
 }