2021-06-30 10:15:55 +02:00
|
|
|
import type { GoToPageEvent } from "../Events/GoToPageEvent";
|
|
|
|
import type { OpenTabEvent } from "../Events/OpenTabEvent";
|
|
|
|
import { IframeApiContribution, sendToWorkadventure } from "./IframeApiContribution";
|
|
|
|
import type { OpenCoWebSiteEvent } from "../Events/OpenCoWebSiteEvent";
|
|
|
|
import type { LoadPageEvent } from "../Events/LoadPageEvent";
|
2021-05-28 01:14:10 +02:00
|
|
|
|
2021-06-30 10:15:55 +02:00
|
|
|
export class WorkadventureNavigationCommands extends IframeApiContribution<WorkadventureNavigationCommands> {
|
|
|
|
callbacks = [];
|
2021-05-28 01:14:10 +02:00
|
|
|
|
|
|
|
openTab(url: string): void {
|
|
|
|
sendToWorkadventure({
|
2021-06-30 10:15:55 +02:00
|
|
|
type: "openTab",
|
|
|
|
data: {
|
|
|
|
url,
|
|
|
|
},
|
2021-05-28 01:14:10 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
goToPage(url: string): void {
|
|
|
|
sendToWorkadventure({
|
2021-06-30 10:15:55 +02:00
|
|
|
type: "goToPage",
|
|
|
|
data: {
|
|
|
|
url,
|
|
|
|
},
|
2021-05-28 01:14:10 +02:00
|
|
|
});
|
|
|
|
}
|
2021-06-17 11:23:56 +02:00
|
|
|
|
|
|
|
goToRoom(url: string): void {
|
2021-06-17 11:32:59 +02:00
|
|
|
sendToWorkadventure({
|
2021-06-30 10:15:55 +02:00
|
|
|
type: "loadPage",
|
|
|
|
data: {
|
|
|
|
url,
|
|
|
|
},
|
2021-06-17 11:32:59 +02:00
|
|
|
});
|
2021-06-17 11:23:56 +02:00
|
|
|
}
|
2021-06-18 17:22:56 +02:00
|
|
|
|
2021-06-28 18:00:48 +02:00
|
|
|
openCoWebSite(url: string, allowApi: boolean = false, allowPolicy: string = ""): void {
|
2021-06-18 17:22:56 +02:00
|
|
|
sendToWorkadventure({
|
2021-06-30 10:15:55 +02:00
|
|
|
type: "openCoWebSite",
|
|
|
|
data: {
|
2021-06-28 18:00:48 +02:00
|
|
|
url,
|
|
|
|
allowApi,
|
|
|
|
allowPolicy,
|
2021-06-30 10:15:55 +02:00
|
|
|
},
|
2021-06-18 17:22:56 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
closeCoWebSite(): void {
|
|
|
|
sendToWorkadventure({
|
2021-06-30 10:15:55 +02:00
|
|
|
type: "closeCoWebSite",
|
|
|
|
data: null,
|
2021-06-18 17:22:56 +02:00
|
|
|
});
|
|
|
|
}
|
2021-05-28 01:14:10 +02:00
|
|
|
}
|
|
|
|
|
2021-06-17 11:23:56 +02:00
|
|
|
export default new WorkadventureNavigationCommands();
|