scottdejonge/map-icons

Google Maps Async

tiarebalbi opened this issue · 3 comments

Hi,

I'm was trying to use map-icons, but i'm having a problem when i try to use the icons lib in a page with async loader.

As we know async call can have some time to have your content loaded and in the code of map-icons.js we have a method loading in the initialization.

https://github.com/scottdejonge/map-icons/blob/master/dist/js/map-icons.js#L41-L42

Error:

Uncaught ReferenceError: google is not defined(anonymous function) @ map-icons.js:42
util.js:32
Google Maps API warning: SensorNotRequired: https://developers.google.com/maps/documentation/javascript/error-messages

Loader Timeline

Map Icons must be loaded after the Google Maps API. These function errors are a result of Map Icons extending the Google Map Marker Class allowing for the label to be added.

Just in case anyone else has the same problem, try to load google maps synchronously. This was causing the problem for me