Skip to content
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

[Feature Request] Re-use Google API library from the window if already available #143

Closed
adriandmitroca opened this issue Jan 28, 2021 · 10 comments
Assignees
Labels
feature requested A new feature requested for the community solved The problem presented is considered solved and the issue closed
Projects

Comments

@adriandmitroca
Copy link

adriandmitroca commented Jan 28, 2021

Is your feature request related to a problem? Please describe.
Library always expects to load Google API library on it's own, despite it could be already loaded from the other sources into the window.

Describe the solution you'd like
Reuse window.google if available.

Describe alternatives you've considered
Trying to override global Vue variables / methods exposed by the library but without any luck.

Additional context

<!DOCTYPE html>
<html lang="en">
  <head>
    <script src="https://maps.googleapis.com/maps/api/js?v=3"></script>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
  </head>
  <body>
    <h1>Plain HTML</h1>
    <div id="map" style="height: 300px; width: 100%;"></div>
    <script>
      new google.maps.Map(document.getElementById("map"), {
        center: { lat: -34.397, lng: 150.644 },
        zoom: 8
      });
    </script>

    <h1>Vue</h1>
    <div id="app"></div>
  </body>
</html>
import Vue from "vue";
import App from "./App.vue";
import * as VueGoogleMaps from "gmap-vue";

Vue.use(VueGoogleMaps, {
  load: false
});

new Vue({
  render: (h) => h(App)
}).$mount("#app");
<template>
  <div id="app">
    <GmapMap
      style="width: 100%; height: 500px"
      :center="{ lat: 50.845593, lng: 4.35082 }"
      :zoom="10"
    />
  </div>
</template>
@adriandmitroca adriandmitroca added the feature requested A new feature requested for the community label Jan 28, 2021
@close-issue-app
Copy link

This issue is closed because it does not meet our issue template. Please read it.

@boring-cyborg
Copy link

boring-cyborg bot commented Jan 28, 2021

Thanks for opening your first issue here! Be sure to follow the issue template!

@create-issue-branch
Copy link

@diegoazh diegoazh added this to To do in gmap-vue via automation Jan 28, 2021
@diegoazh diegoazh reopened this Jan 28, 2021
gmap-vue automation moved this from To do to In progress Jan 28, 2021
@diegoazh diegoazh added the WIP work in progress label Jan 28, 2021
@stale
Copy link

stale bot commented Mar 29, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Mar 29, 2021
@stale stale bot closed this as completed Apr 5, 2021
gmap-vue automation moved this from In progress to Done Apr 5, 2021
@adriandmitroca
Copy link
Author

:(

@diegoazh diegoazh reopened this Nov 18, 2021
gmap-vue automation moved this from Done to In progress Nov 18, 2021
@stale stale bot removed the wontfix label Nov 18, 2021
@stale
Copy link

stale bot commented Jan 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 17, 2022
@stale stale bot closed this as completed Jan 26, 2022
gmap-vue automation moved this from In progress to Done Jan 26, 2022
@diegoazh diegoazh reopened this Feb 11, 2022
gmap-vue automation moved this from Done to In progress Feb 11, 2022
@stale stale bot removed the wontfix label Feb 11, 2022
@diegoazh
Copy link
Owner

I apologize for the bot, is the last time that I try to configure it, if it doesn't work I'll remove it from the repository.

diegoazh added a commit that referenced this issue Feb 13, 2022
- `autobindAllEvents` config option was renamed to `autoBindAllEvents`
- `vueGoogleMapsInit` name was renamed to `GoogleMapsCallback`
- `gmapApi` function was renamed to `getGoogleMapsAPI`
- `MapElementMixin` now is exported from `components` object instead of `helpers` object
- `customCallback` config option was added to reuse existing Google Maps API that already loaded, eg from an HTML file

BREAKING CHANGE: Solve #143, reuse existing google maps api and rename functions
diegoazh added a commit that referenced this issue Feb 13, 2022
- `autobindAllEvents` config option was renamed to `autoBindAllEvents`
- `vueGoogleMapsInit` name was renamed to `GoogleMapsCallback`
- `gmapApi` function was renamed to `getGoogleMapsAPI`
- `MapElementMixin` now is exported from `components` object instead of `helpers` object
- `customCallback` config option was added to reuse existing Google Maps API that already loaded, eg from an HTML file

BREAKING CHANGE: reuse existing google maps api and rename functions
Solve #143
diegoazh added a commit that referenced this issue Feb 13, 2022
- `autobindAllEvents` config option was renamed to `autoBindAllEvents`
- `vueGoogleMapsInit` name was renamed to `GoogleMapsCallback`
- `gmapApi` function was renamed to `getGoogleMapsAPI`
- `MapElementMixin` now is exported from `components` object instead of `helpers` object
- `customCallback` config option was added to reuse existing Google Maps API that already loaded, eg from an HTML file

BREAKING CHANGE: reuse existing google maps api and rename functions
Solve #143
github-actions bot pushed a commit that referenced this issue Feb 13, 2022
# [3.0.0](v2.0.4...v3.0.0) (2022-02-13)

### Features

* **gmap-vue:** add custom callback option to config ([b8409e3](b8409e3)), closes [#143](#143)

### BREAKING CHANGES

* **gmap-vue:** reuse existing google maps api and rename functions
@diegoazh
Copy link
Owner

@adriandmitroca I land a new version where you can do that can you test it, I'm trying to deploy the documentation right now.

@diegoazh
Copy link
Owner

Our new documentation is ready, I tested putting the google maps script in an HTML file and after that, I load the plugin without API key using only the new option customCallback you can find it here. Regards.

@diegoazh diegoazh added solved The problem presented is considered solved and the issue closed and removed WIP work in progress labels Feb 13, 2022
gmap-vue automation moved this from In progress to Done Feb 13, 2022
@diegoazh
Copy link
Owner

Solved on v3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature requested A new feature requested for the community solved The problem presented is considered solved and the issue closed
Projects
No open projects
gmap-vue
  
Done
Development

No branches or pull requests

2 participants