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. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2322 closes #2322
This commit is contained in:
@ -245,16 +245,15 @@ function _loggingFunc(...args) {
|
||||
}
|
||||
|
||||
function init() {
|
||||
// Add some bindings to the global JS namespace; (gjs keeps the web
|
||||
// browser convention of having that namespace be called 'window'.)
|
||||
window.global = Shell.Global.get();
|
||||
// Add some bindings to the global JS namespace
|
||||
globalThis.global = Shell.Global.get();
|
||||
|
||||
window.log = _loggingFunc;
|
||||
globalThis.log = _loggingFunc;
|
||||
|
||||
window._ = Gettext.gettext;
|
||||
window.C_ = Gettext.pgettext;
|
||||
window.ngettext = Gettext.ngettext;
|
||||
window.N_ = s => s;
|
||||
globalThis._ = Gettext.gettext;
|
||||
globalThis.C_ = Gettext.pgettext;
|
||||
globalThis.ngettext = Gettext.ngettext;
|
||||
globalThis.N_ = s => s;
|
||||
|
||||
GObject.gtypeNameBasedOnJSPath = true;
|
||||
|
||||
|
Reference in New Issue
Block a user