35 lines
844 B
TypeScript
35 lines
844 B
TypeScript
|
import type { GoToPageEvent } from '../Events/GoToPageEvent';
|
||
|
import type { OpenTabEvent } from '../Events/OpenTabEvent';
|
||
|
import { IframeApiContribution, sendToWorkadventure } from './IframeApiContribution';
|
||
|
|
||
|
|
||
|
|
||
|
class WorkadventureNavigationCommands extends IframeApiContribution<WorkadventureNavigationCommands> {
|
||
|
|
||
|
readonly subObjectIdentifier = "nav"
|
||
|
|
||
|
readonly addMethodsAtRoot = true
|
||
|
callbacks = []
|
||
|
|
||
|
|
||
|
openTab(url: string): void {
|
||
|
sendToWorkadventure({
|
||
|
"type": 'openTab',
|
||
|
"data": {
|
||
|
url
|
||
|
} as OpenTabEvent
|
||
|
});
|
||
|
}
|
||
|
|
||
|
goToPage(url: string): void {
|
||
|
sendToWorkadventure({
|
||
|
"type": 'goToPage',
|
||
|
"data": {
|
||
|
url
|
||
|
} as GoToPageEvent
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
export default new WorkadventureNavigationCommands();
|