• Returns the current global scope object, for a normal web page this will be the current window, for a Web Worker this will be current worker global scope via "self". The internal implementation returns the first available instance object in the following order

    • globalThis (New standard)
    • self (Will return the current window instance for supported browsers)
    • window (fallback for older browser implementations)
    • global (NodeJS standard)
    • (When all else fails) While the return type is a Window for the normal case, not all environments will support all of the properties or functions. And this caches the lookup of the global as in some environments this can be an expensive operation.

    Parameters

    • Optional useCached: boolean

      [Optional] used for testing to bypass the cached lookup, when true this will cause the cached global to be reset.

    Returns Window