Bubble [WIP] (still need to do the javascript part)
This commit is contained in:
parent
540e5783b6
commit
fd5b598b63
3 changed files with 25 additions and 17 deletions
20
front/src/Api/iframe/Bubble.ts
Normal file
20
front/src/Api/iframe/Bubble.ts
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import { IframeApiContribution } from './IframeApiContribution';
|
||||||
|
|
||||||
|
class WorkadventureNavigationCommands extends IframeApiContribution<WorkadventureNavigationCommands> {
|
||||||
|
|
||||||
|
readonly subObjectIdentifier = "bubble"
|
||||||
|
|
||||||
|
readonly addMethodsAtRoot = true
|
||||||
|
callbacks = []
|
||||||
|
displayBubble(): void {
|
||||||
|
window.parent.postMessage({ 'type': 'displayBubble' }, '*');
|
||||||
|
}
|
||||||
|
|
||||||
|
removeBubble(): void {
|
||||||
|
window.parent.postMessage({ 'type': 'removeBubble' }, '*');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default new WorkadventureNavigationCommands();
|
|
@ -20,7 +20,7 @@ export interface IframeCallbackContribution<Guard extends tg.TypeGuard<unknown>,
|
||||||
callback: (payloadData: T) => void
|
callback: (payloadData: T) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PossibleSubobjects = "zone" | "chat" | "ui" | "nav" | "sound" | "cowebsite" | "player"
|
export type PossibleSubobjects = "zone" | "chat" | "ui" | "nav" | "sound" | "cowebsite" | "player" | "bubble"
|
||||||
/**
|
/**
|
||||||
* !! be aware that the implemented attributes (addMethodsAtRoot and subObjectIdentifier) must be readonly
|
* !! be aware that the implemented attributes (addMethodsAtRoot and subObjectIdentifier) must be readonly
|
||||||
*
|
*
|
||||||
|
|
|
@ -11,7 +11,9 @@ const importType = Promise.all([
|
||||||
import("./Api/iframe/Sound"),
|
import("./Api/iframe/Sound"),
|
||||||
import("./Api/iframe/zone-events"),
|
import("./Api/iframe/zone-events"),
|
||||||
import("./Api/iframe/Navigation"),
|
import("./Api/iframe/Navigation"),
|
||||||
import("./Api/iframe/CoWebsite")
|
import("./Api/iframe/CoWebsite"),
|
||||||
|
import("./Api/iframe/Player"),
|
||||||
|
import("./Api/iframe/Bubble")
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,10 +48,7 @@ type WorkAdventureApiFiles = {
|
||||||
} & SubObjectTypes
|
} & SubObjectTypes
|
||||||
|
|
||||||
export interface WorkAdventureApi extends WorkAdventureApiFiles {
|
export interface WorkAdventureApi extends WorkAdventureApiFiles {
|
||||||
disablePlayerControls(): void;
|
|
||||||
restorePlayerControls(): void;
|
|
||||||
displayBubble(): void;
|
|
||||||
removeBubble(): void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
@ -62,17 +61,6 @@ declare global {
|
||||||
|
|
||||||
|
|
||||||
window.WA = {
|
window.WA = {
|
||||||
|
|
||||||
|
|
||||||
displayBubble(): void {
|
|
||||||
window.parent.postMessage({ 'type': 'displayBubble' }, '*');
|
|
||||||
},
|
|
||||||
|
|
||||||
removeBubble(): void {
|
|
||||||
window.parent.postMessage({ 'type': 'removeBubble' }, '*');
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
...({} as WorkAdventureApiFiles),
|
...({} as WorkAdventureApiFiles),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue