Also, this is part of the code:
We only wait for the callback and then get the credentials to log in and 
define our style. but the callback is never invoked in the failed case

public static loadApi(callback: () => void = null): void {
        if (MapUtil.loaded) {
            callback();
        } else {
            var script = 
<HTMLScriptElement>document.createElement("script");
            script.src = 
"https://www.google.com/jsapi?callback=MapUtil.googleLoaderCallback";;
            script.type = "text/javascript";
            document.getElementsByTagName("head")[0].appendChild(script);
            MapUtil.loadApiCallback = callback;
        }
    }
    public static googleLoaderCallback() {
        MapUtil.loaded = true;
        let credentials = 
window.sessionStorage.getItem("googleMapsApiCredentials");
        if (credentials === null || credentials === "") {
            KnockoutUtil.ajax({
                url: "/api/configurationapi/GetGoogleMapsAPICredentials",
                type: "GET",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                async: false,
                success: (data: string) => {
                    if (data !== null && data !== "") {

                        credentials = data;
                        
window.sessionStorage.setItem("googleMapsApiCredentials", credentials);
                    }
                },
                error: () => {
                    throw new Error("Credentials could not be loaded")
                }
            })
        }
        let a: object;
            (<any>google).load("maps", "3", {
                "other_params": 
`client=${credentials}&sensor=false&channel=${client}&libraries=geometry,visualization,places,drawing
 
`,
                "callback": () => {
                    MapUtil.impactMap = new 
google.maps.StyledMapType(MapUtil.MAP_IMPACT, { name: "Impact" });
                    MapUtil.loadApiCallback();
                    MapUtil.createPopupClass();
                }
            });
    }

>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/1a2cc920-fdfb-4cc0-a5c6-154704c0e53d%40googlegroups.com.

Reply via email to