From fb7fe0dc0a04f9999de13a370125fef76535552f Mon Sep 17 00:00:00 2001 From: Alexis Faizeau Date: Mon, 25 Oct 2021 18:50:40 +0200 Subject: [PATCH] Rename cowebsite API functions --- docs/maps/api-nav.md | 15 ++++++--------- front/src/Api/iframe/nav.ts | 33 ++------------------------------- 2 files changed, 8 insertions(+), 40 deletions(-) diff --git a/docs/maps/api-nav.md b/docs/maps/api-nav.md index 386edf9e..d1e045bc 100644 --- a/docs/maps/api-nav.md +++ b/docs/maps/api-nav.md @@ -52,9 +52,7 @@ WA.nav.goToRoom("/_/global/.json#start-layer-2") ### Opening/closing web page in Co-Websites ``` -WA.nav.openCoWebsite(url: string, allowApi: boolean = false, allowPolicy: string = "", position: number = 0): Promise -WA.nav.closeCoWebsite(coWebsiteId: string): Promise -WA.nav.closeCoWebsites(): Promise +WA.nav.openCoWebSite(url: string, allowApi: boolean = false, allowPolicy: string = "", position: number = 0): Promise ``` Opens the webpage at "url" in an iFrame (on the right side of the screen) or close that iFrame. `allowApi` allows the webpage to use the "IFrame API" and execute script (it is equivalent to putting the `openWebsiteAllowApi` property in the map). `allowPolicy` grants additional access rights to the iFrame. The `allowPolicy` parameter is turned into an [`allow` feature policy in the iFrame](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-allow), position in whitch slot the web page will be open. @@ -62,17 +60,16 @@ Opens the webpage at "url" in an iFrame (on the right side of the screen) or clo Example: ```javascript -const coWebsite = await WA.nav.openCoWebsite('https://www.wikipedia.org/'); -const coWebsiteWorkAdventure = await WA.nav.openCoWebsite('https://workadventu.re/', true, "", 1); +const coWebsite = await WA.nav.openCoWebSite('https://www.wikipedia.org/'); +const coWebsiteWorkAdventure = await WA.nav.openCoWebSite('https://workadventu.re/', true, "", 1); // ... -WA.nav.closeCoWebsite(coWebsite.id); -WA.nav.closeCoWebsites(); +coWebsite.close(); ``` ### Opening/closing web page in Co-Websites ``` -WA.nav.getCoWebsites(): Promise +WA.nav.getCoWebSites(): Promise ``` Get all opened co-websites withe their ids and positions. @@ -80,5 +77,5 @@ Get all opened co-websites withe their ids and positions. Example: ```javascript -const coWebsites = await WA.nav.getCowebsites(); +const coWebsites = await WA.nav.getCowebSites(); ``` diff --git a/front/src/Api/iframe/nav.ts b/front/src/Api/iframe/nav.ts index e91ded73..5acfa2a5 100644 --- a/front/src/Api/iframe/nav.ts +++ b/front/src/Api/iframe/nav.ts @@ -41,22 +41,7 @@ export class WorkadventureNavigationCommands extends IframeApiContribution { + async openCoWebSite(url: string, allowApi?: boolean, allowPolicy?: string, position?: number): Promise { const result = await queryWorkadventure({ type: "openCoWebsite", data: { @@ -69,7 +54,7 @@ export class WorkadventureNavigationCommands extends IframeApiContribution { + async getCoWebSites(): Promise { const result = await queryWorkadventure({ type: "getCoWebsites", data: undefined @@ -86,20 +71,6 @@ export class WorkadventureNavigationCommands extends IframeApiContribution