summaryrefslogtreecommitdiffstats
path: root/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/use-chromeutils-definelazygetter.rst
blob: 61d13f4e63a215e912d9b7f2128228fc414bf3da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use-chromeutils-definelazygetter
================================

Require use of ``ChromeUtils.defineLazyGetter`` rather than ``XPCOMUtils.defineLazyGetter``.

Examples of incorrect code for this rule:
-----------------------------------------

.. code-block:: js

    XPCOMUtils.defineLazyGetter(lazy, "textEncoder", function () {
        return new TextEncoder();
    });

Examples of correct code for this rule:
---------------------------------------

.. code-block:: js

    ChromeUtils.defineLazyGetter(lazy, "textEncoder", function () {
        return new TextEncoder();
    });