-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathindex.ts
More file actions
41 lines (34 loc) · 992 Bytes
/
index.ts
File metadata and controls
41 lines (34 loc) · 992 Bytes
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
/**
* @license
* Copyright 2026 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
// [START maps_js_api_loader_map]
// [START maps_js_api_loader_map_load]
// Import the needed libraries.
import { setOptions, importLibrary } from '@googlemaps/js-api-loader';
// [END maps_js_api_loader_map_load]
const API_KEY = 'AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8';
async function initMap(): Promise<void> {
// [START maps_js_api_loader_map_options]
// Set loader options.
setOptions({
key: API_KEY,
v: 'weekly',
});
// [END maps_js_api_loader_map_options]
// Load the Maps library.
const { Map } = (await importLibrary('maps'));
// Set map options.
const mapOptions = {
center: { lat: 48.8566, lng: 2.3522 },
zoom: 3,
};
// Declare the map.
const map = new Map(
document.getElementById('map') as HTMLElement,
mapOptions
);
}
initMap();
// [END maps_js_api_loader_map]