From def0e3ef8d3d3357d71be55dc3ca104b24fa527a Mon Sep 17 00:00:00 2001 From: roymondchen Date: Tue, 21 Jun 2022 20:13:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(stage):=20=E6=8F=90=E4=BE=9BtmagicRuntimeR?= =?UTF-8?q?eady=20message=E4=BA=8B=E4=BB=B6=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/stage/src/StageCore.ts | 4 ++-- packages/stage/src/StageRender.ts | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/stage/src/StageCore.ts b/packages/stage/src/StageCore.ts index c371600f..2d67b84b 100644 --- a/packages/stage/src/StageCore.ts +++ b/packages/stage/src/StageCore.ts @@ -230,11 +230,11 @@ export default class StageCore extends EventEmitter { * 挂载Dom节点 * @param el 将stage挂载到该Dom节点上 */ - public mount(el: HTMLDivElement): void { + public async mount(el: HTMLDivElement) { this.container = el; const { mask, renderer } = this; - renderer.mount(el); + await renderer.mount(el); mask.mount(el); this.emit('mounted'); diff --git a/packages/stage/src/StageRender.ts b/packages/stage/src/StageRender.ts index 78a9f262..84c44d19 100644 --- a/packages/stage/src/StageRender.ts +++ b/packages/stage/src/StageRender.ts @@ -121,5 +121,12 @@ export default class StageRender extends EventEmitter { } this.emit('onload'); + + this.contentWindow.postMessage( + { + tmagicRuntimeReady: true, + }, + '*', + ); }; }