mozilla

Revision 43830 of JavaScript code modules

  • Revision slug: JavaScript_code_modules
  • Revision title: JavaScript code modules
  • Revision id: 43830
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment cleanup; add Services.jsm; 27 words added, 6 words removed

Revision Content

{{ gecko_minversion_header("1.9") }}

JavaScript code modules let multiple privileged JavaScript scopes share code. For example, a module could be used by Firefox itself as well as by extensions, in order to avoid code duplication.

General topics

Using JavaScript code modules
An introduction to how to use JavaScript code modules.
Component.utils.import
How to import a JavaScript code module.
Code snippets: Modules
Examples of how to use code modules.
Mozilla Labs JS Modules
This page features a list of JS modules, along with download links and documentation, that extension developers can use in their code.

Standard code modules

ctypes.jsm {{ fx_minversion_inline("3.6") }}
Provides an interface that allows JavaScript code to call native libraries without requiring the development of an XPCOM component.
ISO8601DateUtils.jsm
Provides routines to convert between JavaScript Date objects and ISO 8601 date strings.
NetUtil.jsm
Provides helpful networking utility functions, including the ability to easily copy data from an input stream to an output stream asynchronously.
openLocationLastURL.jsm
Provides access to the last URL opened using the "Open Location" option in the File menu.
PluralForm.jsm
Provides an easy way to get the correct plural forms for the current locale, as well as ways to localize to a specific plural rule.
Services.jsm
Provides getters for conveniently obtaining access to commonly-used services.
XPCOMUtils.jsm
Contains utilities for JavaScript components loaded by the JS component loader.

Revision Source

<p>{{ gecko_minversion_header("1.9") }}</p>
<p>JavaScript code modules let multiple privileged JavaScript scopes share code. For example, a module could be used by Firefox itself as well as by extensions, in order to avoid code duplication.</p>
<table class="mainpage-table"> <tbody> <tr> <td width="50%"> <h2>General topics</h2> <dl> <dt><a class="internal" href="/en/JavaScript_code_modules/Using_JavaScript_code_modules" title="en/JavaScript code modules/Using JavaScript code modules">Using JavaScript code modules</a></dt> <dd>An introduction to how to use JavaScript code modules.</dd> <dt><a class="internal" href="/en/Components.utils.import" title="en/Components.utils.import">Component.utils.import</a></dt> <dd>How to import a JavaScript code module.</dd> <dt><a href="/En/Code_snippets/Modules" title="En/Code_snippets/Modules">Code snippets: Modules</a></dt> <dd>Examples of how to use code modules.</dd> <dt><a class="external" href="http://wiki.mozilla.org/Labs/JS_Modules">Mozilla Labs JS Modules</a></dt> <dd>This page features a list of JS modules, along with download links and documentation, that extension developers can use in their code.<a href="/En/Code_snippets/Modules" title="En/Code_snippets/Modules"><br> </a></dd> <dt> </dt></dl> <dl> </dl></td> <td width="50%"> <h2>Standard code modules</h2> <dl> <dl> <dt><a href="/en/JavaScript_code_modules/ctypes.jsm" title="en/JavaScript code modules/ctypes.jsm">ctypes.jsm</a> {{ fx_minversion_inline("3.6") }}</dt> <dd>Provides an interface that allows JavaScript code to call native libraries without requiring the development of an XPCOM component.</dd> <dt><a href="/en/JavaScript_code_modules/ISO8601DateUtils.jsm" title="en/JavaScript code modules/ISO8601DateUtils.jsm">ISO8601DateUtils.jsm</a></dt> <dd>Provides routines to convert between JavaScript <a href="/en/Core_JavaScript_1.5_Reference/Global_Objects/Date" title="en/Core JavaScript 1.5 Reference/Global Objects/Date"><code>Date</code></a> objects and ISO 8601 date strings.</dd> </dl> <dl> <dt><a class="internal" href="/en/JavaScript_code_modules/NetUtil.jsm" title="en/JavaScript code modules/NetUtil.jsm"><span style="font-weight: bold;">NetUtil.jsm</span></a></dt> <dd>Provides helpful networking utility functions, including the ability to easily copy data from an input stream to an output stream asynchronously.</dd> <dt><a class="internal" href="/en/JavaScript_code_modules/openLocationLastURL.jsm" title="en/JavaScript code modules/openLocationLastURL.jsm">openLocationLastURL.jsm</a></dt> <dd>Provides access to the last URL opened using the "Open Location" option in the File menu.</dd> <dt><a href="/en/Localization_and_Plurals" title="en/Localization and Plurals">PluralForm.jsm</a></dt> <dd>Provides an easy way to get the correct plural forms for the current locale, as well as ways to localize to a specific plural rule.</dd> <dt><a href="/en/JavaScript_code_modules/Services.jsm" title="en/JavaScript code modules/Services.jsm">Services.jsm</a></dt> <dd>Provides getters for conveniently obtaining access to commonly-used services.</dd> <dt><a class="internal" href="/en/JavaScript_code_modules/XPCOMUtils.jsm" title="en/JavaScript code modules/XPCOMUtils.jsm">XPCOMUtils.jsm</a></dt> <dd>Contains utilities for JavaScript components loaded by the JS component loader.</dd> </dl> </dl></td> </tr> </tbody> </table> 
Revert to this revision