-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebComponent conflicting with previously loaded maps #78
Comments
It's not a bad idea. Generally, we encourage components to load their own resources/dependencies, but I'd be in favor of PR that uses an existing instance of |
Obviously, no one should ever have two google.map scripts loaded into the same page, as it creates a large number of problems overall. I'll work on a PR next week. I need to sign all the paperwork. In the meantime, this is what I ended up with:
I don't know if I love this. It does short circuit loading maps if you already have an instance on the page. If you happen to have multiple map instances on your page, there is a chance that another one might end up 'preloaded'. Also, the orginal notify-event passes in some arguments for the return object. This short I wanted to detect if it was preloaded in my code. This will fire pre-loaded once you have maps instanced. I was trying to make as few changes as possible, but it might make sense to add a method to iron-jsonp-library (if one doesn't already exist) to check if a library already is loaded by its methods. |
I ran into this too. Loading the script from the |
I am migrating a site to web components and there are parts of our site with libraries that I can't swap over immediately. To this end, we already have Google Maps loading in the site.
The problem is that the google-maps-api doesn't check or have any way to not reload the API if it already exists in the site.
At the top of _computeUrl if you put in:
if (google && google.maps) { return null; }
It would be much better to have a method to indicate that a google.maps library is already loaded and to just use that. I think that is better than making a duplicate instance of google-maps and the other.
The text was updated successfully, but these errors were encountered: