Skip to content

Commit 26b24f5

Browse files
committed
docs: update readme
1 parent 323800f commit 26b24f5

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ script.
2222
## Requirements
2323

2424
- [Sign up with Google Maps Platform]
25-
- A Google Cloud Platform [project] with the [**Maps JavaScript API**]
26-
[maps-sdk] enabled
25+
- A Google Cloud Platform [project] with the [**Maps JavaScript API**][maps-sdk]
26+
enabled
2727
- An [API key] associated with the project above
2828

2929
## Installation
@@ -68,11 +68,27 @@ await importLibrary("maps");
6868
const map = new google.maps.Map(mapEl, mapOptions);
6969

7070
// Or, if you prefer using callbacks instead of async/await:
71-
importLibrary("maps").then(() => {
72-
const map = new google.maps.Map(mapEl, mapOptions);
71+
importLibrary("maps").then(({ Map }) => {
72+
const map = new Map(mapEl, mapOptions);
7373
});
7474
```
7575

76+
If you use web components from the Google Maps JavaScript API (e.g. `gmp-map`,
77+
and `gmp-advanced-marker`), you need to import them as well:
78+
79+
```javascript
80+
import { setOptions, importLibrary } from "@googlemaps/js-api-loader";
81+
82+
// Set the options for loading the API.
83+
setOptions({ key: "your-api-key-here" });
84+
85+
await importLibrary("maps"); // needed for gmp-map
86+
await importLibrary("marker"); // needed for gmp-advanced-marker
87+
88+
// or:
89+
await Promise.all([importLibrary("maps"), importLibrary("marker")]);
90+
```
91+
7692
## Documentation
7793

7894
This package exports just two functions, `setOptions` and `importLibrary`.
@@ -170,7 +186,7 @@ Platform [Terms of Service].
170186

171187
This library is not a Google Maps Platform Core Service. Therefore, the
172188
Google Maps Platform Terms of Service (e.g. Technical Support Services,
173-
Service Level Agreements, and Deprecation Policy) do not apply to the code
189+
Service Level Agreements, and Deprecation Policy) don’t apply to the code
174190
in this library.
175191

176192
### European Economic Area (EEA) developers

0 commit comments

Comments
 (0)