Compare Revisions

Code Samples

Revision 89365:

Revision 89365 by bparr on

Revision 89366:

Revision 89366 by Mh512 on

Title:
Code Samples
Code Samples
Slug:
Addons/Add-on_Manager/Code_Samples
Addons/Add-on_Manager/Code_Samples
Tags:
NeedsTechnicalReview, Add-ons, NeedsEditorialReview, "Add-on Manager"
NeedsTechnicalReview, Add-ons, NeedsEditorialReview, "Add-on Manager"
Content:

Revision 89365
Revision 89366
nn7    <h3>
8      Accessing file and version information
9    </h3>
10    <pre class="brush: js">
11Components.utils.import("resource://gre/modules/AddonManager.jsm"
 >);
12 
13AddonManager.getAddonByID("my-addon@foo.com", function(addon) {
14  alert("My extension's version is " + addon.version);
15  alert("Did I remember to include that file.txt file in my XPI? 
 >" +
16        addon.hasResource("file.txt") ? "YES!" : "No  ");
17  alert("Let's pretend I did, it's available from the URL " + add
 >on.getResourceURL("file.txt"));
18});
19</pre>
n16    <p>n
17      &nbsp;
18    </p>
tt56    <p>
57      &nbsp;
58    </p>

Back to History