@@ -16,6 +16,7 @@ import {
16
16
parseContentType ,
17
17
createAppContainer ,
18
18
setDocCurrentScript ,
19
+ getRenderNode ,
19
20
} from '@garfish/utils' ;
20
21
import { Garfish } from '../garfish' ;
21
22
import { interfaces } from '../interface' ;
@@ -184,7 +185,7 @@ export class App {
184
185
revertCurrentScript ( ) ;
185
186
}
186
187
187
- show ( ) {
188
+ async show ( ) {
188
189
this . active = true ;
189
190
const { display, mounted, provider } = this ;
190
191
if ( display ) return false ;
@@ -193,7 +194,7 @@ export class App {
193
194
return false ;
194
195
}
195
196
196
- this . addContainer ( ) ;
197
+ await this . addContainer ( ) ;
197
198
this . callRender ( provider , false ) ;
198
199
this . display = true ;
199
200
this . context . activeApps . push ( this ) ;
@@ -294,10 +295,10 @@ export class App {
294
295
}
295
296
296
297
// Performs js resources provided by the module, finally get the content of the export
297
- compileAndRenderContainer ( ) {
298
+ async compileAndRenderContainer ( ) {
298
299
// Render the application node
299
300
// If you don't want to use the CJS export, at the entrance is not can not pass the module, the require
300
- this . renderTemplate ( ) ;
301
+ await this . renderTemplate ( ) ;
301
302
302
303
// Execute asynchronous script
303
304
return new Promise < void > ( ( resolve ) => {
@@ -393,13 +394,16 @@ export class App {
393
394
394
395
// Create a container node and add in the document flow
395
396
// domGetter Have been dealing with
396
- private addContainer ( ) {
397
- if ( typeof ( this . appInfo . domGetter as Element ) . appendChild === 'function' ) {
398
- ( this . appInfo . domGetter as Element ) . appendChild ( this . appContainer ) ;
397
+ private async addContainer ( ) {
398
+ // Initialize the mount point, support domGetter as promise, is advantageous for the compatibility
399
+ const domGetter = await getRenderNode ( this . appInfo . domGetter ) ;
400
+
401
+ if ( typeof domGetter . appendChild === 'function' ) {
402
+ domGetter . appendChild ( this . appContainer ) ;
399
403
}
400
404
}
401
405
402
- private renderTemplate ( ) {
406
+ private async renderTemplate ( ) {
403
407
const { appInfo, entryManager, resources } = this ;
404
408
const { url : baseUrl , DOMApis } = entryManager ;
405
409
const { htmlNode, appContainer } = createAppContainer ( appInfo . name ) ;
@@ -409,7 +413,7 @@ export class App {
409
413
this . appContainer = appContainer ;
410
414
411
415
// To append to the document flow, recursive again create the contents of the HTML or execute the script
412
- this . addContainer ( ) ;
416
+ await this . addContainer ( ) ;
413
417
414
418
const customRenderer : Parameters < typeof entryManager . createElements > [ 0 ] = {
415
419
meta : ( ) => null ,
0 commit comments