HPNeo/gmaps — pull request #64 by felipeleusin (2012-06-27 19:13:50+00:00)
Title: Enable seamless usage with RequireJS and async plugin

Great plugin, i've just had to make one little adjustment so I could use it with RequireJS in one of my projects.

To load googlemaps with RequireJS i had to use the async plugin and you're code was throwing an error since it access google.maps.* code in it's first run. I've just create a wrapper method and make sure it ran only once the first time it was needed. This allowed me to use a single require statement instead of nesting requires.

I.E.:

require(["google/gmaps","async!http://maps.googleapis.com/maps/api/js?sensor=false!callback"], function() { foo(); });

instead of

require(["async!http://maps.googleapis.com/maps/api/js?sensor=false!callback"], function() {
required(["google/gmaps"],function() {
foo();
}
});