Skip to content

Commit ff16219

Browse files
authored
Refactor marker initialization in initMap function
1 parent 806cf33 commit ff16219

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

samples/advanced-markers-simple/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,16 @@
77
// [START maps_advanced_markers_simple]
88
// [START maps_advanced_markers_simple_snippet]
99
const mapElement = document.querySelector('gmp-map') as google.maps.MapElement;
10-
let innerMap;
1110

1211
async function initMap() {
1312
// Request needed libraries.
1413
const { Map } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary;
1514
const { AdvancedMarkerElement } = await google.maps.importLibrary("marker") as google.maps.MarkerLibrary;
1615

17-
innerMap = mapElement.innerMap;
18-
1916
const marker = new AdvancedMarkerElement({
20-
map: innerMap,
2117
position: { lat: 37.4239163, lng: -122.0947209 },
2218
});
19+
mapElement.append(marker);
2320
}
2421
// [END maps_advanced_markers_simple_snippet]
2522
initMap();

0 commit comments

Comments
 (0)