Migrate getCurrentUser() to WA.player (#1279)

This commit is contained in:
GRL78 2021-07-13 15:13:14 +02:00 committed by GitHub
parent 41a1f56bd5
commit b2ea368097
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 33 deletions

View file

@ -1,6 +1,24 @@
{.section-title.accent.text-primary}
# API Player functions Reference
### Getting information on the current user
```
WA.player.getCurrentUser(): Promise<User>
```
Return a promise that resolves to a `User` object with the following attributes :
* **id (string) :** ID of the current user
* **nickName (string) :** name displayed above the current user
* **tags (string[]) :** list of all the tags of the current user
Example :
```javascript
WA.player.getCurrentUser().then((user) => {
if (user.nickName === 'ABC') {
console.log(user.tags);
}
})
```
### Listen to player movement
```
WA.player.onPlayerMove(callback: HasPlayerMovedEventCallback): void;

View file

@ -99,24 +99,6 @@ WA.room.getCurrentRoom((room) => {
})
```
### Getting information on the current user
```
WA.player.getCurrentUser(): Promise<User>
```
Return a promise that resolves to a `User` object with the following attributes :
* **id (string) :** ID of the current user
* **nickName (string) :** name displayed above the current user
* **tags (string[]) :** list of all the tags of the current user
Example :
```javascript
WA.room.getCurrentUser().then((user) => {
if (user.nickName === 'ABC') {
console.log(user.tags);
}
})
```
### Changing tiles
```
WA.room.setTiles(tiles: TileDescriptor[]): void