Skip to content

Commit bcba7f3

Browse files
authored
fix: Moves Place class declaration to avoid confusing pattern. (#1838)
Just a simple small change to move the Place class declaration into the function that's using it, to avoid using the pattern of passing Place as a function parameter.
1 parent d0181ae commit bcba7f3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

samples/place-class/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ let centerCoordinates = { lat: 37.4161493, lng: -122.0812166 };
1010

1111
async function initMap() {
1212
const { Map } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary;
13-
const { Place } = await google.maps.importLibrary("places") as google.maps.PlacesLibrary;
1413

1514
map = new Map(document.getElementById('map') as HTMLElement, {
1615
center: centerCoordinates,
@@ -20,11 +19,12 @@ async function initMap() {
2019
// [END_EXCLUDE]
2120
});
2221

23-
getPlaceDetails(Place);
22+
getPlaceDetails();
2423
}
2524

2625
// [START maps_place_class_fetchfields]
27-
async function getPlaceDetails(Place) {
26+
async function getPlaceDetails() {
27+
const { Place } = await google.maps.importLibrary("places") as google.maps.PlacesLibrary;
2828
const { AdvancedMarkerElement } = await google.maps.importLibrary("marker") as google.maps.MarkerLibrary;
2929
// Use place ID to create a new Place instance.
3030
const place = new Place({
@@ -50,4 +50,4 @@ async function getPlaceDetails(Place) {
5050

5151
initMap();
5252
// [END maps_place_class]
53-
export { };
53+
export { };

0 commit comments

Comments
 (0)