Skip to content

Commit 00456ef

Browse files
committed
feat(google-maps): Optimize @googlemaps/js-api-loader to use importLibrary method
1 parent 7f92c3d commit 00456ef

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

plugin/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@
8989
"access": "public"
9090
},
9191
"dependencies": {
92-
"@googlemaps/js-api-loader": "~1.13.7",
92+
"@googlemaps/js-api-loader": "~1.16.2",
9393
"@googlemaps/markerclusterer": "~2.0.7",
94-
"@types/google.maps": "~3.50.5"
94+
"@types/google.maps": "~3.53.4"
9595
}
9696
}

plugin/src/web.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import type {
3030
} from './implementation';
3131

3232
export class CapacitorGoogleMapsWeb extends WebPlugin implements CapacitorGoogleMapsPlugin {
33-
private gMapsRef: typeof google.maps | undefined = undefined;
33+
private gMapsRef: google.maps.MapsLibrary | undefined = undefined;
3434
private maps: {
3535
[id: string]: {
3636
element: HTMLElement;
@@ -113,12 +113,10 @@ export class CapacitorGoogleMapsWeb extends WebPlugin implements CapacitorGoogle
113113
const loader = new lib.Loader({
114114
apiKey: apiKey ?? '',
115115
version: 'weekly',
116-
libraries: ['places'],
117116
language,
118117
region,
119118
});
120-
const google = await loader.load();
121-
this.gMapsRef = google.maps;
119+
this.gMapsRef = await loader.importLibrary('maps');
122120
console.log('Loaded google maps API');
123121
}
124122
}

0 commit comments

Comments
 (0)