Labs/JS Modules: Difference between revisions

advise users to avoid namespace collisions
(advise users to avoid namespace collisions)
Line 3: Line 3:
= JavsScript Modules =
= JavsScript Modules =


Here you'll find a collection of modules which you can import into your extension.  The goal is to make extension development easier by implementing functionality common functionality as reusable libraries. The modules here are designed to be imported with Components.utils.import().  If you would like to contribute a new module, get in touch with us at #labs!
Here you'll find a collection of modules which you can import into your extension.  The goal is to make extension development easier by implementing common functionality as reusable libraries.
 
The modules here are designed to be imported with Components.utils.import().  To avoid namespace collisions with core code and other extensions, use the two-parameter form of import() to import the module's symbols into a namespace defined by your extension, i.e.:
 
let MyExtension = {};
Components.utils.import("resource://myextension/modules/SomeModule.js", MyExtension);
 
If you would like to contribute a new module, get in touch with us at #labs!


== Logging ==
== Logging ==
canmove, Confirmed users
2,056

edits