diff options
author | Andy Holmes <andrew.g.r.holmes@gmail.com> | 2020-04-23 19:04:05 -0700 |
---|---|---|
committer | Andy Holmes <andrew.g.r.holmes@gmail.com> | 2020-04-24 10:07:01 -0700 |
commit | b246b6ef06881fd1281d0de4e391a00260ee4495 (patch) | |
tree | 8895b1e60a56aa80fcb0ca4159b68a7e6f346779 /modules/script | |
parent | 0c8c3a8e20914778cd443fef249fe236d4250475 (diff) | |
download | gjs-b246b6ef06881fd1281d0de4e391a00260ee4495.tar.gz |
JS: migrate from the global `window` to `globalThis`
As of mozjs68 (gjs-1.64) `globalThis` is recommended over `window` and
it makes more sense in this context anyways. Migrate the few instances
of `window` we use and adjust the eslint configuration.
`window` will continue to resolve to `globalThis`, so this won't affect
extensions or other downstream users.
Diffstat (limited to 'modules/script')
-rw-r--r-- | modules/script/_bootstrap/coverage.js | 2 | ||||
-rw-r--r-- | modules/script/_bootstrap/default.js | 2 | ||||
-rw-r--r-- | modules/script/package.js | 8 |
3 files changed, 6 insertions, 6 deletions
diff --git a/modules/script/_bootstrap/coverage.js b/modules/script/_bootstrap/coverage.js index 472de844..7cc58a6f 100644 --- a/modules/script/_bootstrap/coverage.js +++ b/modules/script/_bootstrap/coverage.js @@ -3,4 +3,4 @@ exports.debugger = new Debugger(exports.debuggee); exports.debugger.collectCoverageInfo = true; -})(window); +})(globalThis); diff --git a/modules/script/_bootstrap/default.js b/modules/script/_bootstrap/default.js index cc5f94bb..86ef0211 100644 --- a/modules/script/_bootstrap/default.js +++ b/modules/script/_bootstrap/default.js @@ -4,4 +4,4 @@ // Do early initialization here. void exports; -})(window); +})(globalThis); diff --git a/modules/script/package.js b/modules/script/package.js index e3c3d186..0fbc4188 100644 --- a/modules/script/package.js +++ b/modules/script/package.js @@ -117,7 +117,7 @@ function _makeNamePath(n) { * @param {object} params package parameters */ function init(params) { - window.pkg = imports.package; + globalThis.pkg = imports.package; _pkgname = params.name; name = _findEffectiveEntryPointName(); version = params.version; @@ -312,9 +312,9 @@ function initGettext() { Gettext.textdomain(_pkgname); let gettext = imports.gettext; - window._ = gettext.gettext; - window.C_ = gettext.pgettext; - window.N_ = function (x) { + globalThis._ = gettext.gettext; + globalThis.C_ = gettext.pgettext; + globalThis.N_ = function (x) { return x; }; } |