Skip to content

Commit added60

Browse files
authored
Change wc sample back to legacy bootloader (#846)
* Change wc sample back to legacy bootloader ...otherwise the story of "no JS code" is spoiled. * Remove library imports Keep the no-code thing alive and well.
1 parent 7b843c8 commit added60

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

samples/web-components-map/index.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111

1212
<link rel="stylesheet" type="text/css" href="./style.css" />
1313
<script type="module" src="./index.js"></script>
14-
<!-- prettier-ignore -->
15-
<script>(g => { var h, a, k, p = "The Google Maps JavaScript API", c = "google", l = "importLibrary", q = "__ib__", m = document, b = window; b = b[c] || (b[c] = {}); var d = b.maps || (b.maps = {}), r = new Set, e = new URLSearchParams, u = () => h || (h = new Promise(async (f, n) => { await (a = m.createElement("script")); e.set("libraries", [...r] + ""); for (k in g) e.set(k.replace(/[A-Z]/g, t => "_" + t[0].toLowerCase()), g[k]); e.set("callback", c + ".maps." + q); a.src = `https://maps.${c}apis.com/maps/api/js?` + e; d[q] = f; a.onerror = () => h = n(Error(p + " could not load.")); a.nonce = m.querySelector("script[nonce]")?.nonce || ""; m.head.append(a) })); d[l] ? console.warn(p + " only loads once. Ignoring:", g) : d[l] = (f, ...n) => r.add(f) && u().then(() => d[l](f, ...n)) })
16-
({ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly" });</script>
1714
</head>
1815
<body>
1916
<!-- [START maps_web_components_map_gmpmap] -->
@@ -24,6 +21,17 @@
2421
style="height: 400px"
2522
></gmp-map>
2623
<!-- [END maps_web_components_map_gmpmap] -->
24+
<!--
25+
The `defer` attribute causes the script to execute after the full HTML
26+
document has been parsed. For non-blocking uses, avoiding race conditions,
27+
and consistent behavior across browsers, consider loading using Promises. See
28+
https://developers.google.com/maps/documentation/javascript/load-maps-js-api
29+
for more information.
30+
-->
31+
<script
32+
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB41DRUbKWJHPxaFjMAwdrzWzbVKartNGg&libraries=maps,marker&v=weekly"
33+
defer
34+
></script>
2735
</body>
2836
</html>
2937
<!-- [END maps_web_components_map] -->

samples/web-components-map/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
// [START maps_web_components_map]
88
// This example adds a map using web components.
99
async function initMap(): Promise<void> {
10-
await google.maps.importLibrary("maps") as google.maps.MapsLibrary;
1110
console.log('Maps JavaScript API loaded.');
1211
}
1312

0 commit comments

Comments
 (0)