Your Search Results

    JavaScript modules

    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.
    Component.utils.unload
    How to unload 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

    AddonManager.jsm
    Interface to install, manage, and uninstall add-ons.
    AddonRepository.jsm
    Allows searching of the add-ons repository.
    ctypes.jsm
    Provides an interface that allows JavaScript code to call native libraries without requiring the development of an XPCOM component.
    DeferredTask.jsm
    Run a task after a delay.
    Dict.jsm
    Provides an API for key/value pair dictionaries.
    DownloadLastDir.jsm
    Provides the path to the directory into which the last download occurred.
    Downloads.jsm Requires Gecko 23.0
    Provides a single entry point to interact with the downloading capabilities of the platform.
    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.
    Log.jsm (formerly log4moz) Requires Gecko 27.0
    Provides a log4j style API for logging log messages to various endpoints, such as the Browser Console or a file on disk. This module was formerly
    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.
    osfile.jsm
    Provides routines to access files. Read, write, rename, create directories, ...
    PerfMeasurement.jsm
    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
    Provides an easy way to present non-modal notifications to users.
    Promise.jsm Requires Gecko 25.0
    Implements the Promises/A+ proposal as known in April 2013.
    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.
    Sqlite.jsm Requires Gecko 20.0
    A Promise-based API to mozIStorage/SQLite.
    Task.jsm
    Implements a subset of Task.js to make sequential, asynchronous operations simple, using the power of JavaScript's yield operator.
    Timer.jsm Requires Gecko 22.0
    A pure JS implementation of window.setTimeout.
    XPCOMUtils.jsm
    Contains utilities for JavaScript components loaded by the JS component loader.

    Document Tags and Contributors

    Contributors to this page: Sheppy, Mgjbot, J├╝rgen Jeka, SylvainPasche, MarkFinkle
    Last updated by: Sheppy,