--- title: JavaScript code modules slug: Mozilla/JavaScript_code_modules tags: - Add-ons - Extensions - JavaScript - Modules - NeedsTranslation - TopicStub - XPCOM translation_of: Mozilla/JavaScript_code_modules ---
{{gecko_minversion_header("1.9")}}

Moduły kodu JavaScript pozwalają na udostępnianie kodu wielu uprzywilejowanych zakresów JavaScript. Na przykład moduł może być używany zarówno przez samą przeglądarkę Firefox, jak i przez rozszerzenia, aby uniknąć powielania kodu.

Nie są to standardowe moduły JavaScript . Sprawdź {{jsxref("Statements/export", "export")}} oraz {{jsxref("Statements/import", "import")}} aby dowiedzieć się więcej o tym, jak korzystać ze standardowych modułów.

Tematy główne

Używanie modułów kodu JavaScript
Wprowadzenie do korzystania z modułów kodu JavaScript.
Component.utils.import
Jak zaimportować moduł kodu JavaScript.
Component.utils.unload {{gecko_minversion_inline("7.0")}}
Jak zwolnić moduł kodu JavaScript.
Fragmenty kodu: moduły
Przykłady korzystania z modułów kodu.
Moduły JS Mozilla Labs
Ta strona zawiera listę modułów JavaScript wraz z linkami do pobrania i dokumentacją, które programiści rozszerzeń mogą użyć w swoim kodzie.

Standard code modules

AddonManager.jsm {{gecko_minversion_inline("2.0")}}
Interface to install, manage, and uninstall add-ons.
AddonRepository.jsm {{gecko_minversion_inline("2.0")}}
Allows searching of the add-ons repository.
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.
DeferredTask.jsm {{gecko_minversion_inline("18.0")}}
Run a task after a delay.
Dict.jsm {{gecko_minversion_inline("5.0")}}
Provides an API for key/value pair dictionaries.
DownloadLastDir.jsm {{gecko_minversion_inline("2.0")}}
Provides the path to the directory into which the last download occurred.
Downloads.jsm {{gecko_minversion_inline("23.0")}}
Provides a single entry point to interact with the downloading capabilities of the platform.
FileUtils.jsm {{gecko_minversion_inline("1.9.2")}}
Provides helpers for dealing with files.
Geometry.jsm {{gecko_minversion_inline("2.0")}}
Provides routines for performing basic geometric operations on points and rectangles.
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.
osfile.jsm {{gecko_minversion_inline("16.0")}}
JavaScript module OS.File contains primitives for manipulating files
PerfMeasurement.jsm {{fx_minversion_inline("4.0")}}
Provides access to low-level hardware and OS performance measurement tools.
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.
PopupNotifications.jsm {{gecko_minversion_inline("2.0")}}
Provides an easy way to present non-modal notifications to users.
Promise.jsm {{gecko_minversion_inline("25.0")}}
Implements the Promises/A+ proposal as known in April 2013.
Services.jsm {{gecko_minversion_inline("2.0")}}
Provides getters for conveniently obtaining access to commonly-used services.
source-editor.jsm {{fx_minversion_inline("11.0")}}
The Source Editor is used by developer tools such as the Style Editor; this interface implements the editor and lets you interact with it.
Sqlite.jsm {{gecko_minversion_inline("20.0")}}
A Promise-based API to {{ interface("mozIStorage") }}/SQLite.
Task.jsm {{gecko_minversion_inline("17.0")}}
Implements a subset of Task.js to make sequential, asynchronous operations simple, using the power of JavaScript's yield operator.
Timer.jsm {{gecko_minversion_inline("22.0")}}
A pure JS implementation of window.setTimeout.
XPCOMUtils.jsm
Contains utilities for JavaScript components loaded by the JS component loader.