From 5d0aa835a2c5d55a870a36743ffe48f3877869f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dicte=20Q?= <37311765+HimeShaman@users.noreply.github.com> Date: Mon, 3 Jan 2022 14:21:59 +0100 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: David NĂ©grier --- docs/maps/api-camera.md | 5 ++--- docs/maps/api-player.md | 4 ++-- docs/maps/api-room.md | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/docs/maps/api-camera.md b/docs/maps/api-camera.md index c9dc413f..cb1fe72d 100644 --- a/docs/maps/api-camera.md +++ b/docs/maps/api-camera.md @@ -19,7 +19,6 @@ The event has the following attributes : Example : ```javascript -WA.camera.onCameraUpdate.subscribe((worldView) => console.log(worldView)); +const subscription = WA.camera.onCameraUpdate().subscribe((worldView) => console.log(worldView)); //later... -WA.camera.onCameraUpdate().unsubscribe(); -``` \ No newline at end of file +subscription.unsubscribe(); \ No newline at end of file diff --git a/docs/maps/api-player.md b/docs/maps/api-player.md index 2bfad463..58d5701a 100644 --- a/docs/maps/api-player.md +++ b/docs/maps/api-player.md @@ -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()` ```typescript -WA.onInit().then(() => { - console.log('Position: ', WA.player.getPosition()); +WA.onInit().then(async () => { + console.log('Position: ', await WA.player.getPosition()); }) ``` diff --git a/docs/maps/api-room.md b/docs/maps/api-room.md index bcc53332..7d438a1f 100644 --- a/docs/maps/api-room.md +++ b/docs/maps/api-room.md @@ -215,16 +215,16 @@ interface CreateEmbeddedWebsiteEvent { name: string; // A unique name for this iframe url: string; // The URL the iframe points to. position: { - x: number, // relative to the map or player coordinates, depending on origin - y: number, // relative to the map or player coordinates, depending on origin - width: number, // In pixels, sensitive to zoom level and scale - height: number, // In pixels, sensitive to zoom level and scale + x: number, // In "game" 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 "game" pixels + height: number, // In "game" pixels }, visible?: boolean, // Whether to display the iframe or not allowApi?: boolean, // Whether the scripting API should be available to the iframe 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 - scale: number, // A ratio used to resize the iframe (will affect the iframe's width and height when it is rendered + 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 } ``` @@ -269,10 +269,10 @@ class EmbeddedWebsite { visible: boolean; allow: string; allowApi: boolean; - x: number; // In 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 - width: number; // In pixels, sensitive to zoom level and scale - height: number; // In pixels, sensitive to zoom level and scale + x: number; // In "game" 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 "game" pixels + height: number; // In "game" pixels origin: "player" | "map"; scale: number; }