Renaming WA.room.getMap to WA.room.getTiledMap

This commit is contained in:
David Négrier 2021-07-21 16:40:53 +02:00
parent 181545e6b7
commit 080d495044
3 changed files with 5 additions and 5 deletions

View File

@ -93,7 +93,7 @@ You need to wait for the end of the initialization before accessing `WA.room.id`
```typescript
WA.onInit().then(() => {
console.log('Room id: ', WA.room.id);
// Will output something like: '/@/myorg/myworld/myroom', or '/_/global/mymap.org/map.json"
// Will output something like: 'https://play.workadventu.re/@/myorg/myworld/myroom', or 'https://play.workadventu.re/_/global/mymap.org/map.json"
})
```
@ -119,13 +119,13 @@ WA.onInit().then(() => {
### Getting map data
```
WA.room.getMap(): Promise<ITiledMap>
WA.room.getTiledMap(): Promise<ITiledMap>
```
Returns a promise that resolves to the JSON map file.
```javascript
const map = await WA.room.getMap();
const map = await WA.room.getTiledMap();
console.log("Map generated with Tiled version ", map.tiledversion);
```

View File

@ -79,7 +79,7 @@ export class WorkadventureRoomCommands extends IframeApiContribution<Workadventu
},
});
}
async getMap(): Promise<ITiledMap> {
async getTiledMap(): Promise<ITiledMap> {
const event = await queryWorkadventure({ type: "getMapData", data: undefined });
return event.data as ITiledMap;
}

View File

@ -6,6 +6,6 @@ WA.onInit().then(() => {
console.log('Player tags: ', WA.player.tags);
});
WA.room.getMap().then((data) => {
WA.room.getTiledMap().then((data) => {
console.log('Map data', data);
})