-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathindex.js
More file actions
54 lines (48 loc) · 1.52 KB
/
Copy pathindex.js
File metadata and controls
54 lines (48 loc) · 1.52 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
'use strict';
/*
* @license
* Copyright 2026 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
/*
* This is a special sample! Having a dedicated test sample makes it easier to
* test changes in a world where sometimes changes must be merged in order to
* test them. This way we can avoid making changes to published content.
* And deliver us from evil.
*/
// [START maps_test_example]
// Declare the gmp-map element.
const mapElement = document.querySelector('gmp-map');
let innerMap;
let center;
async function init() {
// [START maps_test_example_instantiate_map]
// Request the needed libraries.
const [{ AdvancedMarkerElement }] = await Promise.all([
google.maps.importLibrary('marker'),
google.maps.importLibrary('maps'),
]);
// Get the inner map from the gmp-map element.
innerMap = mapElement.innerMap;
innerMap.setOptions({
mapTypeControl: false,
});
// [END maps_test_example_instantiate_map]
// Get the lat/lng from the inner map.
center = innerMap.getCenter();
// [START maps_test_example_instantiate_marker]
// Add a marker, positioned at Uluru.
new AdvancedMarkerElement({
map: innerMap,
position: center,
title: 'Uluru',
});
// [END maps_test_example_instantiate_marker]
// [START maps_test_example_why_me]
console.log(
'Happy Thursday! (TODO: verify whether it is actually Thursday.'
);
// [END maps_test_example_why_me]
}
void init();
// [END maps_test_example]