-
Notifications
You must be signed in to change notification settings - Fork 823
/
index.ts
33 lines (29 loc) · 991 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
// [START maps_advanced_markers_html_simple]
// [START maps_advanced_markers_html_simple_snippet]
async function initMap() {
// Request needed libraries.
const { Map } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary;
const { AdvancedMarkerElement } = await google.maps.importLibrary("marker") as google.maps.MarkerLibrary;
const map = new Map(document.getElementById('map') as HTMLElement, {
center: { lat: 37.42, lng: -122.1 },
zoom: 14,
mapId: '4504f8b37365c3d0',
});
const priceTag = document.createElement('div');
priceTag.className = 'price-tag';
priceTag.textContent = '$2.5M';
const marker = new AdvancedMarkerElement({
map,
position: { lat: 37.42, lng: -122.1 },
content: priceTag,
});
}
// [END maps_advanced_markers_html_simple_snippet]
initMap();
// [END maps_advanced_markers_html_simple]
export { };