MDN wants to learn about developers like you: https://qsurvey.mozilla.com/s3/MDN-dev-survey

JavaScript 代码模块用于具备不同权限的作用域之间的代码共享。例如,Firefox可以使用模块,也可以通过扩展来使用模块,以避免代码复制。

话题总览

使用JavaScript代码模块
介绍如何使用JavaScript代码模块
Component.utils.import
如何导入一个JavaScript的代码模块。
Component.utils.unload
如何上传一个JavaScript的代码模块
代码片段: Module
如何使用模块代码的实例。
Mozilla实验室的 JS Modules
本页面列出了JS模块的列表,以及下载链接和文档,扩展开发人员可以在代码中使用它们。

Standard code modules

ctypes.jsm
Provides an interface that allows JavaScript code to call native libraries without requiring the development of an XPCOM component.
FileUtils.jsm
Provides helpers for dealing with files.
Geometry.jsm
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.
Dict.jsm
Provides an API for key/value pair dictionaries.
NetUtil.jsm
Provides helpful networking utility functions, including the ability to easily copy data from an input stream to an output stream asynchronously.
PopupNotifications.jsm
Provides an easy way to present non-modal notifications to users.
openLocationLastURL.jsm
Provides access to the last URL opened using the "Open Location" option in the File menu.
DownloadLastDir.jsm
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
Provides getters for conveniently obtaining access to commonly-used services.
source-editor.jsm
The Source Editor is used by developer tools such as the Style Editor; this interface implements the editor and lets you interact with it.
XPCOMUtils.jsm
Contains utilities for JavaScript components loaded by the JS component loader.
PerfMeasurement.jsm
Provides access to low-level hardware and OS performance measurement tools.
AddonManager.jsm
Interface to install, manage, and uninstall add-ons.
AddonRepository.jsm
Allows searching of the add-ons repository.

文档标签和贡献者

 此页面的贡献者: ljzzkkkss, teoli
 最后编辑者: ljzzkkkss,