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

feat: Optimize @googlemaps/js-api-loader to use importLibrary method #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
"access": "public"
},
"dependencies": {
"@googlemaps/js-api-loader": "~1.13.7",
"@googlemaps/js-api-loader": "~1.16.2",
"@googlemaps/markerclusterer": "~2.0.7",
"@types/google.maps": "~3.50.5"
"@types/google.maps": "~3.53.4"
}
}
6 changes: 2 additions & 4 deletions plugin/src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import type {
} from './implementation';

export class CapacitorGoogleMapsWeb extends WebPlugin implements CapacitorGoogleMapsPlugin {
private gMapsRef: typeof google.maps | undefined = undefined;
private gMapsRef: google.maps.MapsLibrary | undefined = undefined;
private maps: {
[id: string]: {
element: HTMLElement;
Expand Down Expand Up @@ -113,12 +113,10 @@ export class CapacitorGoogleMapsWeb extends WebPlugin implements CapacitorGoogle
const loader = new lib.Loader({
apiKey: apiKey ?? '',
version: 'weekly',
libraries: ['places'],
language,
region,
});
const google = await loader.load();
this.gMapsRef = google.maps;
this.gMapsRef = await loader.importLibrary('maps');
console.log('Loaded google maps API');
}
}
Expand Down