Labs/Jetpack/FlightDeck/Development Docs/AddonBuilderHelperIntegration: Difference between revisions

From MozillaWiki
< Labs‎ | Jetpack‎ | FlightDeck
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 10: Line 10:
== Installing Add-ons ==
== Installing Add-ons ==


If the Helper is installed hitting '''Test''' should simply install add-on  
If the Helper is installed hitting '''Test''' add-on should be simply installed
  if (window.mozFlightDeck) {
if (window.mozFlightDeck) {
    FD->createAndDownloadXPI // using currently displayed content
  FD->createAndDownloadXPI // using currently displayed content
    window.mozFlightDeck.send({cmd:"install",contents: downloadedXPI})
  window.mozFlightDeck.send({cmd:"install",contents: downloadedXPI}  
  }
  FD->displayNotification
}


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


If browser's version is < 4.0 event will not be fired, but user has to restart the browser. Warning should be displayed that user will loose all unsaved data. '''Check if there it will be possible to display the warning on restarting or if it should be displayed before installing the Helper'''.
If browser's version is < 4.0 event will not be fired, but user has to restart the browser. Warning should be displayed that user will loose all unsaved data. '''Check if there it will be possible to display the warning on restarting or if it should be displayed before installing the Helper'''.

Latest revision as of 14:21, 11 August 2010

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 add-on should be simply installed

if (window.mozFlightDeck) {
  FD->createAndDownloadXPI // using currently displayed content
  window.mozFlightDeck.send({cmd:"install",contents: downloadedXPI}   
  FD->displayNotification
}

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', function() {
    FD->displayNotification
    FD->installAddOn
  });
  // stop listening after some time
  (function() {
    $(document.body).removeEvents('addonbuilderhelperstart');
   }).delay(someTime);
}

If browser's version is < 4.0 event will not be fired, but user has to restart the browser. Warning should be displayed that user will loose all unsaved data. Check if there it will be possible to display the warning on restarting or if it should be displayed before installing the Helper.