B2G/gecko/toolkit/mozapps/extensions/AddonManager.jsm
/**
   * Asynchronously gets an array of add-ons.
   *
   * @param  aIDs
   *         The array of IDs to retrieve
   * @param  aCallback
   *         The callback to pass an array of Addons to
   * @throws if the aID or aCallback arguments are not specified
   */
Asynchronously gets an array of add-ons.
@param  aIDs
The array of IDs to retrieve
@param  aCallback
The callback to pass an array of Addons to
@throws if the aID or aCallback arguments are not specified
Asynchronously gets an array of add - ons . @param aIDs The array of IDs to retrieve @param aCallback The callback to pass an array of Addons to @throws if the aID or aCallback arguments are not specified
function AMI_getAddonsByIDs(aIDs, aCallback) {
    if (!gStarted)
      throw Components.Exception("AddonManager is not initialized",
                                 Cr.NS_ERROR_NOT_INITIALIZED);
    if (!Array.isArray(aIDs))
      throw Components.Exception("aIDs must be an array",
                                 Cr.NS_ERROR_INVALID_ARG);
    if (typeof aCallback != "function")
      throw Components.Exception("aCallback must be a function",
                                 Cr.NS_ERROR_INVALID_ARG);
    let addons = [];
    new AsyncObjectCaller(aIDs, null, {
      nextObject: function(aCaller, aID) {
        AddonManagerInternal.getAddonByID(aID, function(aAddon) {
          addons.push(aAddon);
          aCaller.callNext();
        });
      },
      noMoreObjects: function(aCaller) {
        safeCall(aCallback, addons);
      }
    });
  }
function AMI_getAddonsByIDs ( aIDs , aCallback ) { if ( ! gStarted ) throw Components . Exception ( "AddonManager is not initialized" , Cr . NS_ERROR_NOT_INITIALIZED ) ; if ( ! Array . isArray ( aIDs ) ) throw Components . Exception ( "aIDs must be an array" , Cr . NS_ERROR_INVALID_ARG ) ; if ( typeof aCallback != "function" ) throw Components . Exception ( "aCallback must be a function" , Cr . NS_ERROR_INVALID_ARG ) ; let addons = [ ] ; new AsyncObjectCaller ( aIDs , null , { nextObject : function ( aCaller , aID ) { AddonManagerInternal . getAddonByID ( aID , function ( aAddon ) { addons . push ( aAddon ) ; aCaller . callNext ( ) ; } ) ; } , noMoreObjects : function ( aCaller ) { safeCall ( aCallback , addons ) ; } } ) ; }
Asynchronously gets an array of add-ons.
Asynchronously gets an array of add - ons .