• Return the named global object if available, will return null if the object is not available.

    Type Parameters

    • T

    Parameters

    • name: string | number | symbol

      The globally named object, may be any valid property key (string, number or symbol)

    • Optional useCached: boolean

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

    Returns T | null

    Example

    // This does not cause the evaluation to occur
    window.myGlobal = "Hello";
    let cachedValue = getInst("myGlobal");
    // cachedValue === "Hello"

    window.myGlobal = "Darkness";
    // getInst("myGlobal") === "Darkness"

    let promiseCls = getInst("Promise");
    // May throw if the global is not supported by the runtime
    // otherwise the Promise class.