Пример #1
0
 _bindEvents: function() {
   var _boundUpdateAddons = this._updateAddons.bind(this);
   // Bug 1215546 & 1218298
   // The 'oninstall' event is fired when user started installing the
   // app, but manifest is not available yet. In order to get the
   // manifest, we need to listen to 'downloadsuccess' on the app
   // (not mozApps.mgmt), and that's when manifest will be ready.
   AppsCache.addEventListener('oninstall', (evt) => {
     var app = evt && evt.application;
     // Bug 1220195
     // If installed via WebIDE, _isAddon will return true, and we should
     // run _boundUpdateAddons immediately because 'downloadsuccess' would
     // never fire. If installed from Marketplace we need to wait for the
     // 'downloadsuccess' event and run _boundUpdateAddons later.
     if (this._isAddon(app)) {
       _boundUpdateAddons(evt);
     } else {
       app.addEventListener('downloadsuccess', _boundUpdateAddons);
     }
   });
   AppsCache.addEventListener('onuninstall', _boundUpdateAddons);
   mozApps.mgmt.addEventListener('enabledstatechange', _boundUpdateAddons);
 },
Пример #2
0
    init: function hl_init(elements) {
      this._elements = elements;
      this._renderHomescreens();

      window.addEventListener('applicationinstall',
        this._renderHomescreens.bind(this));
      window.addEventListener('applicationuninstall',
        this._renderHomescreens.bind(this));

      this._elements.moreLink.addEventListener('click',
        this._showMoreHomescreens.bind(this));

      // Refresh the list whenever apps are installed/uninstalled.
      AppsCache.addEventListener('oninstall',
        this._renderHomescreens.bind(this));
      AppsCache.addEventListener('onuninstall',
        this._renderHomescreens.bind(this));

      SettingsListener.observe('homescreen.manifestURL', '', manifestURL => {
        this.manifestURL = manifestURL;
        // There is a race condition, so we need to refresh the list.
        this.listBuilder();
      });
    },
Пример #3
0
 _bindEvents: function pl__bindEvents() {
   this._listRoot.addEventListener('click', this._boundOnAppChoose);
   AppsCache.addEventListener('oninstall', this._boundOnApplicationInstall);
   AppsCache.addEventListener('onuninstall',
     this._boundOnApplicationUninstall);
 },