Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

No API key error #146

Open
berarma opened this issue Sep 3, 2018 · 1 comment
Open

No API key error #146

berarma opened this issue Sep 3, 2018 · 1 comment

Comments

@berarma
Copy link

berarma commented Sep 3, 2018

I'm having problems using an API key. After loading the library I call $.gmap3({ key: "..." })'.

Sometimes it works sometimes it doesn't. The problem is that the Google API is loaded in the onReady event, but sometimes the onReady event has already fired when the JS loads. Thus the API is loaded before I get to set the key, and I can't set the key before loading the API.

I know this is the cause of the problem because if I move the code that loads the API inside the $.gmap3(), after storing the key, it always works.

@berarma
Copy link
Author

berarma commented Nov 8, 2018

I've forked the code and moved the Google API loading code inside $.gmap3(). This gives me control over when and how scripts are loaded. I'm not doing a PR since I guess this is not what everybody wants.

I haven't found another way to make it work. When you have ten scripts in your site, all of them trying to be loaded first and none of them really needing to be the first you need to take control.

Nice regards.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant