codegile / gmaps-markerwithlabel-amd

Google Maps MarkerWithLabel Utility with AMD support ( works with requirejs optimizer )
Apache License 2.0
5 stars 3 forks source link

Check if google maps API has already been loaded #1

Open svenlaater opened 9 years ago

svenlaater commented 9 years ago

Firstly, it's nice that markerWithLabel is now available as a bower package - kudos for that.

There is an issue though that happens when google maps API has already been loaded before markerWithLabel module is required.

You have included the Google Maps API multiple times on this page. This may cause unexpected errors.

A check whether google maps API has already been included would be nice e.g.

(function(factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD
        if (!window.google) {
          define(['async!https://maps.googleapis.com/maps/api/js?key=AIzaSyD1O9N-77QOCYJ6wgsbJWgJYBJWd3K_VJg&sensor=false'], factory);
        }
gabriellupu commented 9 years ago

Hi @svenlaater ! I'll try to figure out a nice way to add this and update the code. Thanks a lot for your suggestion.

csdougliss commented 7 years ago

@gabriellupu any chance of making this changed? Thank you