in packages/core/kernal/src/application/Application.ts [87:115]
async mount(dom?: Element, { customProps }: { customProps?: any } = {}) {
const { baseFrame } = this.context;
if (baseFrame) {
// listen for message and popstate evt
baseFrame.contentWindow.addEventListener('popstate', this._emitLocationChange);
baseFrame.contentWindow.addEventListener('message', this._emitGlobalEvent);
}
const parcel = mountRootParcel({
// unique name for multi instances
name: `${this.appInfo.name}_${Date.now()}`,
bootstrap: flattenFnArray(this.remoteApp.bootstrap, 'bootstrap'),
mount: flattenFnArray(this.remoteApp.mount, 'mount'),
unmount: flattenFnArray(this.remoteApp.unmount, 'unmount'),
update: flattenFnArray(this.remoteApp.update, 'update'),
}, {
domElement: dom || this.appInfo.dom,
appProps: {
name: this.appInfo.name,
emitter: createEventBus(),
__appInfo__: this.appInfo,
...(customProps || this.appInfo.customProps),
},
});
this.attachParcel(parcel);
return this.parcel.mountPromise;
}