Skip to content

Commit

Permalink
feat(google-maps): Optimize @googlemaps/js-api-loader to use importLi…
Browse files Browse the repository at this point in the history
…brary method
  • Loading branch information
A1Jan committed Mar 1, 2024
1 parent 17afbe3 commit 553e198
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions google-maps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,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 google-maps/src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ 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 @@ -126,12 +126,10 @@ export class CapacitorGoogleMapsWeb
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

0 comments on commit 553e198

Please sign in to comment.