diff --git a/src/main.ts b/src/main.ts index 0d634d49d341c0d4fae4ec826f9d0a60e886f62c..bbdb19d58d2bd78d0b2bda8af490a4f7d7577e7d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -55,9 +55,8 @@ function allowsChild(parent, child) { } } -function sendFrameResizeEventToParent(view: string) { +(window as any).sendViewChangeToParent = function (view: "timeline" | "start" | "account-setup") { window.parent?.postMessage(view); -} +}; -(window as any).sendFrameResizeEventToParent = sendFrameResizeEventToParent; main(); diff --git a/src/ui/views/RootView.ts b/src/ui/views/RootView.ts index 434b9e99037ae2e3d2e17b585d9afe069b9ef9ef..1d101a2069a12d720dbd4ed5cfc399c9c377012c 100644 --- a/src/ui/views/RootView.ts +++ b/src/ui/views/RootView.ts @@ -10,15 +10,13 @@ export class RootView extends TemplateView<RootViewModel> { render(t, vm: RootViewModel) { return t.mapView(vm => vm.activeSection, section => { + (window as any).sendViewChangeToParent(section); switch(section) { case "start": - window.sendFrameResizeEventToParent("start"); return new StartView(vm); case "account-setup": - window.sendFrameResizeEventToParent("account-setup"); return new AccountSetupView(vm.accountSetupViewModel); case "timeline": - window.sendFrameResizeEventToParent("timeline"); return new ChatterboxView(vm.chatterboxViewModel); } return null;