From 64a00481f031699b3a5d9ef37fcd038294a80737 Mon Sep 17 00:00:00 2001 From: jonny Date: Mon, 21 Jun 2021 18:39:02 +0200 Subject: [PATCH] fixed wrong import --- .../src/Api/Events/ui/MenuItemClickedEvent.ts | 9 -------- front/src/Api/iframe/Ui/MenuItem.ts | 11 +++++++++ front/src/Phaser/Menu/MenuScene.ts | 2 +- front/src/iframe_api.ts | 23 ++++++++++--------- 4 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 front/src/Api/iframe/Ui/MenuItem.ts diff --git a/front/src/Api/Events/ui/MenuItemClickedEvent.ts b/front/src/Api/Events/ui/MenuItemClickedEvent.ts index 6444cb09..fad2944f 100644 --- a/front/src/Api/Events/ui/MenuItemClickedEvent.ts +++ b/front/src/Api/Events/ui/MenuItemClickedEvent.ts @@ -1,5 +1,4 @@ import * as tg from "generic-type-guard"; -import { iframeListener } from '../../IframeListener'; export const isMenuItemClickedEvent = new tg.IsInterface().withProperties({ @@ -11,11 +10,3 @@ export const isMenuItemClickedEvent = export type MenuItemClickedEvent = tg.GuardedType; -export function sendMenuClickedEvent(menuItem: string) { - iframeListener.postMessage({ - 'type': 'menuItemClicked', - 'data': { - menuItem: menuItem, - } as MenuItemClickedEvent - }); -} \ No newline at end of file diff --git a/front/src/Api/iframe/Ui/MenuItem.ts b/front/src/Api/iframe/Ui/MenuItem.ts new file mode 100644 index 00000000..9782ea7a --- /dev/null +++ b/front/src/Api/iframe/Ui/MenuItem.ts @@ -0,0 +1,11 @@ +import type { MenuItemClickedEvent } from '../../Events/ui/MenuItemClickedEvent'; +import { iframeListener } from '../../IframeListener'; + +export function sendMenuClickedEvent(menuItem: string) { + iframeListener.postMessage({ + 'type': 'menuItemClicked', + 'data': { + menuItem: menuItem, + } as MenuItemClickedEvent + }); +} \ No newline at end of file diff --git a/front/src/Phaser/Menu/MenuScene.ts b/front/src/Phaser/Menu/MenuScene.ts index d5d0387a..e405a758 100644 --- a/front/src/Phaser/Menu/MenuScene.ts +++ b/front/src/Phaser/Menu/MenuScene.ts @@ -1,6 +1,6 @@ import { Subscription } from 'rxjs'; -import { sendMenuClickedEvent } from '../../Api/Events/ui/MenuItemClickedEvent'; import { registerMenuCommandStream } from '../../Api/Events/ui/MenuItemRegisterEvent'; +import { sendMenuClickedEvent } from '../../Api/iframe/Ui/MenuItem'; import { connectionManager } from "../../Connexion/ConnectionManager"; import { localUserStore } from "../../Connexion/LocalUserStore"; import { worldFullWarningStream } from "../../Connexion/WorldFullWarningStream"; diff --git a/front/src/iframe_api.ts b/front/src/iframe_api.ts index ae5321cf..874f0ace 100644 --- a/front/src/iframe_api.ts +++ b/front/src/iframe_api.ts @@ -1,4 +1,3 @@ -import {registeredCallbacks} from "./Api/iframe/registeredCallbacks"; import { IframeResponseEvent, IframeResponseEventMap, @@ -6,15 +5,17 @@ import { TypedMessageEvent } from "./Api/Events/IframeEvent"; import chat from "./Api/iframe/chat"; -import type {IframeCallback} from './Api/iframe/IframeApiContribution'; -import nav from "./Api/iframe/nav"; import controls from "./Api/iframe/controls"; -import ui from "./Api/iframe/ui"; -import sound from "./Api/iframe/sound"; +import type { IframeCallback } from './Api/iframe/IframeApiContribution'; +import nav from "./Api/iframe/nav"; +import { registeredCallbacks } from "./Api/iframe/registeredCallbacks"; import room from "./Api/iframe/room"; -import type {ButtonDescriptor} from "./Api/iframe/Ui/ButtonDescriptor"; -import type {Popup} from "./Api/iframe/Ui/Popup"; -import type {Sound} from "./Api/iframe/Sound/Sound"; +import sound from "./Api/iframe/sound"; +import type { Sound } from "./Api/iframe/Sound/Sound"; +import ui from "./Api/iframe/ui"; +import type { ButtonDescriptor } from "./Api/iframe/Ui/ButtonDescriptor"; +import type { Popup } from "./Api/iframe/Ui/Popup"; + const wa = { ui, @@ -77,7 +78,7 @@ const wa = { /** * @deprecated Use WA.sound.loadSound instead */ - loadSound(url: string) : Sound { + loadSound(url: string): Sound { console.warn('Method WA.loadSound is deprecated. Please use WA.sound.loadSound instead'); return sound.loadSound(url); }, @@ -85,7 +86,7 @@ const wa = { /** * @deprecated Use WA.nav.goToPage instead */ - goToPage(url : string) : void { + goToPage(url: string): void { console.warn('Method WA.goToPage is deprecated. Please use WA.nav.goToPage instead'); nav.goToPage(url); }, @@ -101,7 +102,7 @@ const wa = { /** * @deprecated Use WA.nav.openCoWebSite instead */ - openCoWebSite(url : string) : void{ + openCoWebSite(url: string): void { console.warn('Method WA.openCoWebSite is deprecated. Please use WA.nav.openCoWebSite instead'); nav.openCoWebSite(url); },