In browser JS code, a "global" variable is actually (always? usually?) a member of the window object. We also see the window object used in Thunderbird, but there is also an object named globalThis. For example, the Services object is a member of globalThis.
When, if at all, should we use globalThis? And which variables should be made members of globalThis rather than of window (assuming they're not local, which they should be of course if one can manage it).
In browser JS code, a "global" variable is actually (always? usually?) a member of the
window
object. We also see thewindow
object used in Thunderbird, but there is also an object namedglobalThis
. For example, theServices
object is a member ofglobalThis
.When, if at all, should we use
globalThis
? And which variables should be made members ofglobalThis
rather than ofwindow
(assuming they're not local, which they should be of course if one can manage it).