Apply suggestions from code review

Co-authored-by: David Négrier <d.negrier@thecodingmachine.com>
This commit is contained in:
Bénédicte Q 2022-01-03 14:21:59 +01:00 committed by GitHub
parent 7c34e0a435
commit 5d0aa835a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 15 deletions

View File

@ -19,7 +19,6 @@ The event has the following attributes :
Example : Example :
```javascript ```javascript
WA.camera.onCameraUpdate.subscribe((worldView) => console.log(worldView)); const subscription = WA.camera.onCameraUpdate().subscribe((worldView) => console.log(worldView));
//later... //later...
WA.camera.onCameraUpdate().unsubscribe(); subscription.unsubscribe();
```

View File

@ -101,8 +101,8 @@ The player's current position is available using the `WA.player.getPosition()` f
You need to wait for the end of the initialization before calling `WA.player.getPosition()` You need to wait for the end of the initialization before calling `WA.player.getPosition()`
```typescript ```typescript
WA.onInit().then(() => { WA.onInit().then(async () => {
console.log('Position: ', WA.player.getPosition()); console.log('Position: ', await WA.player.getPosition());
}) })
``` ```

View File

@ -215,16 +215,16 @@ interface CreateEmbeddedWebsiteEvent {
name: string; // A unique name for this iframe name: string; // A unique name for this iframe
url: string; // The URL the iframe points to. url: string; // The URL the iframe points to.
position: { position: {
x: number, // relative to the map or player coordinates, depending on origin x: number, // In "game" pixels, relative to the map or player coordinates, depending on origin
y: number, // relative to the map or player coordinates, depending on origin y: number, // In "game" pixels, relative to the map or player coordinates, depending on origin
width: number, // In pixels, sensitive to zoom level and scale width: number, // In "game" pixels
height: number, // In pixels, sensitive to zoom level and scale height: number, // In "game" pixels
}, },
visible?: boolean, // Whether to display the iframe or not visible?: boolean, // Whether to display the iframe or not
allowApi?: boolean, // Whether the scripting API should be available to the iframe allowApi?: boolean, // Whether the scripting API should be available to the iframe
allow?: string, // The list of feature policies allowed allow?: string, // The list of feature policies allowed
origin: "player" | "map" // The origin used to place the x and y coordinates of the iframe's top-left corner origin: "player" | "map" // The origin used to place the x and y coordinates of the iframe's top-left corner, defaults to "map"
scale: number, // A ratio used to resize the iframe (will affect the iframe's width and height when it is rendered scale: number, // A ratio used to resize the iframe
} }
``` ```
@ -269,10 +269,10 @@ class EmbeddedWebsite {
visible: boolean; visible: boolean;
allow: string; allow: string;
allowApi: boolean; allowApi: boolean;
x: number; // In pixels, relative to the map or player coordinates, depending on origin x: number; // In "game" pixels, relative to the map or player coordinates, depending on origin
y: number; // In pixels, relative to the map or player coordinates, depending on origin y: number; // In "game" pixels, relative to the map or player coordinates, depending on origin
width: number; // In pixels, sensitive to zoom level and scale width: number; // In "game" pixels
height: number; // In pixels, sensitive to zoom level and scale height: number; // In "game" pixels
origin: "player" | "map"; origin: "player" | "map";
scale: number; scale: number;
} }