File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ export const registerFluentComponents = (...fluentComponents) => {
99
1010 const registry = {
1111 register ( container : any ) {
12+ if ( ! container ) {
13+ return ;
14+ }
15+
1216 for ( const component of fluentComponents ) {
1317 component ( ) . register ( container ) ;
1418 }
Original file line number Diff line number Diff line change 55 * -------------------------------------------------------------------------------------------
66 */
77
8- ( function ( ) {
8+ ( async function ( ) {
99 'use strict' ;
1010
1111 var rootPath = getScriptPath ( ) ;
1515 window . WebComponents = window . WebComponents || { } ;
1616 window . WebComponents . root = rootPath + 'wc/' ;
1717
18+ await waitUntilReady ( ) ;
19+
1820 addScript ( rootPath + 'wc/webcomponents-loader.js' ) ;
1921 addScript ( rootPath + 'mgt.es6.js' ) ;
2022 } else {
4850 return true ;
4951 }
5052
53+ function waitUntilReady ( ) {
54+
55+ return new Promise ( function ( resolve , reject ) {
56+ if ( document . body ) {
57+ resolve ( ) ;
58+ }
59+
60+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
61+ resolve ( ) ;
62+ } )
63+ } ) ;
64+ } ;
65+
5166 function addScript ( src , onload ) {
5267 // TODO: support async loading
5368
5873 // tag.addEventListener("load", onload);
5974 // }
6075
61- document . write ( tag . outerHTML ) ;
62- // document.head.appendChild(tag);
76+ // document.write(tag.outerHTML);
77+ document . head . appendChild ( tag ) ;
6378 }
6479} ) ( ) ;
You can’t perform that action at this time.
0 commit comments