import { ReactiveVar } from "meteor/reactive-var";
// import "@types/googlemaps";

declare global {
    interface Window {
        initGoogle: () => any
        google: typeof google
    }
}

const gScript = window.document.createElement("script");
gScript.src = "https://maps.googleapis.com/maps/api/js?key=" + "AIzaSyAKv6hltj1UcCf9Wnf4Z0yc_14MkfG49-M" + "&libraries=places&callback=initGoogle&language=English";
window.document.body.appendChild(gScript);

const ready = new ReactiveVar(false);

const Google = {
    ready: () => ready.get()
};

window.initGoogle = function () {
    console.log("maps callback");
    ready.set(true);
};

export default Google;