Skip to content

Commit 2af0486

Browse files
authored
Use named import in the Readme (#182)
* Use named import in the Readme Named import is better practice as it will lead to smaller bundle size when used * fix spacing
1 parent 13cb72b commit 2af0486

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,30 +40,30 @@ In addition to the details and examples provided in this readme, check out the [
4040
**Recommended for:** advanced applications
4141

4242
```ts
43-
import * as maptilersdk from '@maptiler/sdk';
43+
import { config, Map } from '@maptiler/sdk';
4444

4545
// Add your MapTiler Cloud API key to the config
4646
// (Go to https://cloud.maptiler.com/account/keys/ to get one for free!)
47-
maptilersdk.config.apiKey = 'YOUR_API_KEY';
47+
config.apiKey = 'YOUR_API_KEY';
4848

4949
// Let's say you have a DIV ready to receive a map
5050
const mapContainer = document.getElementById('my-container-div');
5151

5252
// Instantiate the map
53-
const map = new maptilersdk.Map({
53+
const map = new Map({
5454
container: mapContainer,
5555
});
5656
```
5757

5858
Alternatively, the `apiKey` can be set as Map option instead of in the `config` object. Yet, this will still internally propagate to the `config` object:
5959
```ts
60-
import * as maptilersdk from '@maptiler/sdk';
60+
import { Map } from '@maptiler/sdk';
6161

6262
// Let's say you have a DIV ready to receive a map
6363
const mapContainer = document.getElementById('my-container-div');
6464

6565
// Instantiate the map
66-
const map = new maptilersdk.Map({
66+
const map = new Map({
6767
container: mapContainer,
6868
apiKey: 'YOUR_API_KEY'
6969
});

0 commit comments

Comments
 (0)