mozilla

Revision 43837 of JavaScript code modules

  • Revision slug: JavaScript_code_modules
  • Revision title: JavaScript code modules
  • Revision id: 43837
  • Created:
  • Creator: Hipokrit
  • Is current revision? No
  • Comment 6 words added

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 {{ gecko_minversion_inline("1.9.1.4") }}
Provides access to the last URL opened using the "Open Location" option in the File menu.
DownloadLastDir.jsm {{ gecko_minversion_inline("2.0") }}
Provides the path to the directory into which the last download occurred.
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  {{ gecko_minversion_inline("2.0") }}
Provides getters for conveniently obtaining access to commonly-used services.
XPCOMUtils.jsm
Contains utilities for JavaScript components loaded by the JS component loader.
PerfMeasurement.jsm {{ fx_minversion_inline("4.0") }}
Provides access to low-level hardware and OS performance measurement tools.

 

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" title="./Using">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="./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="./ISO8601DateUtils.jsm">ISO8601DateUtils.jsm</a></dt> <dd>Provides routines to convert between JavaScript <a href="/en/JavaScript/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="./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="./openLocationLastURL.jsm">openLocationLastURL.jsm</a> {{ gecko_minversion_inline("1.9.1.4") }}</dt> <dd>Provides access to the last URL opened using the "Open Location" option in the File menu.</dd> <dt><a href="/en/JavaScript_code_modules/DownloadLastDir.jsm" title="en/JavaScript/Code modules/DownloadLastDir.jsm">DownloadLastDir.jsm</a> {{ gecko_minversion_inline("2.0") }}</dt> <dd>Provides the path to the directory into which the last download occurred.</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="./Services.jsm">Services.jsm</a>  {{ gecko_minversion_inline("2.0") }}</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="./XPCOMUtils.jsm">XPCOMUtils.jsm</a></dt> <dd>Contains utilities for JavaScript components loaded by the JS component loader.</dd> <dt><a href="/en/JavaScript_code_modules/PerfMeasurement.jsm" title="en/JavaScript/Code_modules/PerfMeasurement.jsm">PerfMeasurement.jsm</a> {{ fx_minversion_inline("4.0") }}</dt> <dd>Provides access to low-level hardware and OS performance measurement tools.</dd> </dl> </dl></td> </tr> </tbody> </table> <p> </p> 
Revert to this revision