feat(stage): 提供tmagicRuntimeReady message事件通知

This commit is contained in:
roymondchen 2022-06-21 20:13:53 +08:00 committed by jia000
parent 23776299a7
commit def0e3ef8d
2 changed files with 9 additions and 2 deletions

View File

@ -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');

View File

@ -121,5 +121,12 @@ export default class StageRender extends EventEmitter {
}
this.emit('onload');
this.contentWindow.postMessage(
{
tmagicRuntimeReady: true,
},
'*',
);
};
}