Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Repositório Add-on

Esta tradução está incompleta. Ajude atraduzir este artigo.

The Add-on Repository is responsible for finding available add-ons; it provides an interface for interacting with the addons.mozilla.org (AMO) site. Its API provides URLs that can be visited to browse the repository's add-ons. The API also offers two ways to search for and retrieve an array of Addon instances: retrieveRecommendedAddons(), which returns a list of recommended add-ons, and searchAddons(), which performs a search of the repository.

These searches are asynchronous; results are passed to the provided SearchCallback object when the search is completed. Results passed to the SearchCallback object only include add-ons that are compatible with the current application and are not already installed or in the process of being installed. AddonRepository can only process one search at a time. A new search will immediately fail if the AddonRepository is already handling another search request.

To import the Add-on Repository code module, use:

Components.utils.import("resource://gre/modules/AddonRepository.jsm");

Method overview

string getRecommendedURL()
string getSearchURL(in string searchTerms)
void cancelSearch()
void retrieveRecommendedAddons(in integer maxResults, in SearchCallback callback)
void searchAddons(in string searchTerms, in integer maxResults, in SearchCallback callback)

Properties

Property Type Description
homepageURL string The URL of the repository site's home page.
isSearching boolean true if a search is currently in progress; otherwise false.

Methods

getRecommendedURL()

Returns the URL that can be visited to see recommended add-ons.

string getRecommendedURL();
Parameters

None.

Return value

An URL indicating the repository's page of recommended add-ons.

getSearchURL()

Returns an URL of a web page that can be visited to see search results for the specified search terms.

string getSearchURL(
  in string searchTerms
);
Parameters
searchTerms
Search terms used to search the repository.
Return value

The URL of the search results page for the specified search terms.

cancelSearch()

Cancels the search in progress. Does nothing if there is no search in progress.

void cancelSearch();
Parameters

None.

retrieveRecommendedAddons()

Begins a search for recommended add-ons in the repository. The list of recommended add-ons frequently changes. Results will be passed to the given SearchCallback callback.

void retrieveRecommendedAddons(
  in integer maxResults,
  in SearchCallback callback
);
Parameters
maxResults
The maximum number of results to return.
callback
The SearchCallback callback to which results will be delivered.

searchAddons()

Begins a search for add-ons in this repository. Results will be passed to the given callback.

string searchAddons(
  in string searchTerms,
  in integer maxResults,
  in SearchCallback callback
);
Parameters
searchTerms
The search terms to pass to AMO. The results will match what you would get if you typed this string in the search box on the AMO web site.
maxResults
The maximum number of results to return.
callback
The SearchCallback callback to pass results to.

See also

Etiquetas do documento e colaboradores

 Colaboradores desta página: fabianosantos.net
 Última atualização por: fabianosantos.net,