added example script for map exit

This commit is contained in:
jonny 2021-04-29 10:43:51 +02:00
parent 006195e8cc
commit 8f6c65384a

View file

@ -1,14 +1,16 @@
/// <reference path="../../front/src/iframe_api.ts" />
var zoneName = "popUpGoToPageZone"; var zoneName = "popUpGoToPageZone";
var urlPricing = "https://workadventu.re/pricing"; var urlPricing = "https://workadventu.re/pricing";
var urlGettingStarted = "https://workadventu.re/getting-started"; var urlGettingStarted = "https://workadventu.re/getting-started";
var isCoWebSiteOpened = false; var urlRelativeMap = "script_api.json";
var isCoWebSiteOpened = false;
WA.onChatMessage((message => { WA.onChatMessage((message => {
WA.sendChatMessage('Poly Parrot says: "'+message+'"', 'Poly Parrot'); WA.sendChatMessage('Poly Parrot says: "' + message + '"', 'Poly Parrot');
})); }));
WA.onEnterZone(zoneName, () => { WA.onEnterZone(zoneName, () => {
WA.openPopup("popUp","Open Links",[ WA.openPopup("popUp", "Open Links", [
{ {
label: "Open Tab", label: "Open Tab",
className: "popUpElement", className: "popUpElement",
@ -18,27 +20,34 @@ WA.onEnterZone(zoneName, () => {
}) })
}, },
{ {
label: "Go To Page", className : "popUpElement", label: "Go To Page", className: "popUpElement",
callback:(popup => { callback: (popup => {
WA.goToPage(urlPricing); WA.goToPage(urlPricing);
popup.close(); popup.close();
}) })
} },
,
{ {
label: "openCoWebSite", className : "popUpElement", label: "openCoWebSite", className: "popUpElement",
callback:(popup => { callback: (popup => {
WA.openCoWebSite(urlPricing); WA.openCoWebSite(urlPricing);
isCoWebSiteOpened = true; isCoWebSiteOpened = true;
popup.close(); popup.close();
}) })
}, {
label: "load grouped map",
className: "popUpElement",
callback: (popup => {
WA.loadPage(urlRelativeMap);
popup.close();
})
}]); }]);
}) })
WA.onLeaveZone(zoneName, () => { WA.onLeaveZone(zoneName, () => {
if (isCoWebSiteOpened) { if(isCoWebSiteOpened) {
WA.closeCoWebSite(); WA.closeCoWebSite();
isCoWebSiteOpened = false; isCoWebSiteOpened = false;
} }