11/**
22 * @license
3- * Copyright 2019 Google LLC. All Rights Reserved.
3+ * Copyright 2025 Google LLC. All Rights Reserved.
44 * SPDX-License-Identifier: Apache-2.0
55 */
66
77// [START maps_js_api_loader_map]
8- import { setOptions , importLibrary } from "@googlemaps/js-api-loader" ;
8+ // [START maps_js_api_loader_map_load]
9+ // Import the needed libraries.
10+ import { setOptions , importLibrary } from '@googlemaps/js-api-loader' ;
11+ // [END maps_js_api_loader_map_load]
912
10- const API_KEY = " AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8" ;
13+ const API_KEY = ' AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8' ;
1114
1215async function initMap ( ) : Promise < void > {
13- setOptions ( { key : API_KEY } ) ;
14-
15- const { Map } = await importLibrary ( "maps" ) as google . maps . MapsLibrary ;
16-
17- const mapOptions = {
18- center : { lat : 48.8566 , lng : 2.3522 } ,
19- zoom : 3 ,
20- } ;
21-
22- const map = new Map ( document . getElementById ( "map" ) as HTMLElement , mapOptions ) ;
23-
16+ // [START maps_js_api_loader_map_options]
17+ // Set loader options.
18+ setOptions ( {
19+ key : API_KEY ,
20+ v : 'weekly' ,
21+ } ) ;
22+ // [END maps_js_api_loader_map_options]
23+
24+ // Load the Maps library.
25+ const { Map } = ( await importLibrary ( 'maps' ) ) as google . maps . MapsLibrary ;
26+
27+ // Set map options.
28+ const mapOptions = {
29+ center : { lat : 48.8566 , lng : 2.3522 } ,
30+ zoom : 3 ,
31+ } ;
32+
33+ // Declare the map.
34+ const map = new Map (
35+ document . getElementById ( 'map' ) as HTMLElement ,
36+ mapOptions
37+ ) ;
2438}
2539
2640initMap ( ) ;
27- // [END maps_js_api_loader_map]
41+ // [END maps_js_api_loader_map]
0 commit comments