rungwiroon/BlazorGoogleMaps

Loading google maps libraries (Support/Move to)

Nickztar opened this issue · 9 comments

https://developers.google.com/maps/documentation/javascript/libraries#libraries-for-bootstrap-url-legacy

The current way of using this library is dependent on using the legacy way of loading extra libraries and also loading the api. I have thought a bit about this problem and I think it would/should be possible to use the new way, which allows loading more libraries and lazy-load the current ones. This is somewhat of a big change but could be very nice. This way we could abstract away parts of the required setup (adding maps to index.html etc). I will try to create a PR soon so just creating a issue to see if this is something that is of intrest?

Pros:

  • We can abstract the loading process (take api-key & version in a Program.cs registration?)
  • Allows loading more/new libraries
  • Lazy-loading of libraries
  • We could handle failures etc (We would control the load so we could handle issues where js-api is not present)
  • Current way is legacy (not sure if it will be removed?)

Cons:

  • I guess some people like to tune their own api-loading (but feels like a useless thing?)
  • Guess it would be a bit more for us to handle, but we could expore ways for people to customize features etc so we wouldn't have to build support for every new thing they add.

Let me know if anyone has any thoughts/suggestions 😄

I dont see how it is big change.
IMO benefit that map will render faster. Other parts are just minor.
Also i think if you dont explicitly load libraries, key then nothing should be done. We shouldnt change default behavious.

Overall good luck and thank you for effort