Skip to content
This repository was archived by the owner on Nov 9, 2023. It is now read-only.

Do not check for the window.google.maps library #467

Merged
merged 2 commits into from
Jan 10, 2016

Conversation

adelamarre
Copy link
Contributor

This check just dont let us load gmaps.js before the load of the google maps library.
we can not use the bower package google-maps (https://libraries.io/bower/google-maps) to lazy load the google.maps library with bower.

This check just dont let us load gmaps.js before the load of the google maps library.
we can not use the bower package google-maps (https://libraries.io/bower/google-maps) to lazy load the google.maps library with bower.
@adelamarre
Copy link
Contributor Author

Here is how i would use Gmaps :

window.GoogleMapsLoader.load(function(google){
        map = new GMaps({ el: '#map-container' });
        ...
});

But the check avoids this possibility because at this time Gmaps is an empty function.
You may want Gmaps to check for the presence of the window.GoogleMapsLoader but I think this will be too restrictive and will not ensure that google.maps is loaded.

@hpneo
Copy link
Owner

hpneo commented Jan 3, 2016

Have you tried to move that code to the line 152, just after the GMaps constructor? I prefer to maintain the checking code because some people think GMaps already loads Google Maps API.

@adelamarre
Copy link
Contributor Author

Thanks for reply. No, I do not want to change the source of the package because i manage everything with bower and grunt. But we could imagine an other solution to avoid this test ?
It will preserve the warning for new users and let us use your library in continuous integration/deployment process.

@hpneo
Copy link
Owner

hpneo commented Jan 5, 2016

Sorry, I meant the code you are changing in the pull request. Instead of removing the checking and warning in gmaps.core.js, move to the linea 152 in the same file. That way, when someone tries to create a map, it will check if Google Maps is already loaded.

@adelamarre
Copy link
Contributor Author

Ok, sorry. It's done and working for me. Tests are passed too. Please, could you merge this PR ?

hpneo added a commit that referenced this pull request Jan 10, 2016
Check for Google Maps library before creating a GMaps object.
@hpneo hpneo merged commit 64f6652 into hpneo:master Jan 10, 2016
@hpneo
Copy link
Owner

hpneo commented Jan 10, 2016

Thanks for the PR! It's merged now.

hpneo added a commit that referenced this pull request Mar 15, 2016
* Fix bug at trying to remove a large amount of markers inside a marker cluster (see #473)
* Check for Google Maps library before creating a GMaps object (see #467)
* Check the Google Maps API at instantiation instead of declaration (see #467)
* Add polyfill for google.maps.Rectangle.prototype.containsLatLng
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants