From 1147a21ddeaf4e32147c6e0de15c4a5653ae32f9 Mon Sep 17 00:00:00 2001 From: jonny Date: Wed, 16 Jun 2021 17:34:00 +0200 Subject: [PATCH] fixed documentation --- docs/maps/api-reference.md | 19 +++++++++++++++++++ maps/tests/goToPageScript.js | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/maps/api-reference.md b/docs/maps/api-reference.md index 9891a88a..80d57ea9 100644 --- a/docs/maps/api-reference.md +++ b/docs/maps/api-reference.md @@ -187,6 +187,25 @@ Example: WA.goToPage('https://www.wikipedia.org/'); ``` +### Going to a different map from the script + +``` + +goToRoom(url: string): void +``` + +Load the map at url without unloading workadventure + +relative urls: "../subFolder/map.json[#start-layer-name]" +global urls: "/_/global/domain/path/map.json[#start-layer-name]" + +Example: + +```javascript +WA.goToRoom('../otherMap/map.json'); +WA.goToRoom("/_/global/.json#start-layer-2") +``` + ### Opening/closing a web page in an iFrame ``` diff --git a/maps/tests/goToPageScript.js b/maps/tests/goToPageScript.js index af5b7f9f..bccbc5d2 100644 --- a/maps/tests/goToPageScript.js +++ b/maps/tests/goToPageScript.js @@ -39,7 +39,7 @@ WA.onEnterZone(zoneName, () => { label: "load grouped map", className: "popUpElement", callback: (popup => { - WA.exitSceneTo(urlRelativeMap); + WA.goToRoom(urlRelativeMap); popup.close(); })