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