choonkeat (owner)

Revisions

gist: 226692 Download_button fork
public
Public Clone URL: git://gist.github.com/226692.git
Embed All Files: show embed
jquery.synchronous.getscript.js #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function on_google_map_ready(callback_fn) {
  function call_when_found(name, fn) {
    var x = function() {
      if (window[name]) {
        log("FOUND", name);
        fn();
      } else {
        log("NOT found", name, new Date());
        setTimeout(x, 500);
      }
    }
    return x;
  }
  jQuery.getScript("http://maps.google.com/maps?file=api&async=2&v=2&sensor=false&key=" + GOOGLE_MAPS_API_KEY, call_when_found("GMap2", function() {
    jQuery.getScript(SITE_URL + "js/markermanager_packed.js", call_when_found("MarkerManager", callback_fn));
  }));
}