File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,36 @@ const vrPresentState = {
6767} ;
6868GlobalContext . vrPresentState = vrPresentState ;
6969
70+ // unpack xr-engine-template in recursive load scenario
71+ class XREngineTemplate extends HTMLTemplateElement {
72+ constructor ( ) {
73+ super ( ) ;
74+
75+ ( async ( ) => {
76+ if ( document . readyState !== 'complete' ) {
77+ await new Promise ( ( accept , reject ) => {
78+ document . addEventListener ( 'readystatechange' , ( ) => {
79+ if ( document . readyState === 'complete' ) {
80+ accept ( ) ;
81+ }
82+ } ) ;
83+ } ) ;
84+ }
85+ const childNodes = Array . from ( this . content . childNodes ) ;
86+ for ( let i = 0 ; i < childNodes . length ; i ++ ) {
87+ const childNode = childNodes [ i ] ;
88+ if ( childNode . nodeType === Node . ELEMENT_NODE ) {
89+ const xrIframe = document . importNode ( childNode , true ) ;
90+ this . insertAdjacentElement ( 'afterend' , xrIframe ) ;
91+ }
92+ }
93+ } ) ( ) ;
94+ }
95+ }
96+ customElements . define ( 'xr-engine-template' , XREngineTemplate , {
97+ extends : 'template' ,
98+ } ) ;
99+
70100class PaymentRequest {
71101 constructor ( methodData , details , options ) {
72102 this . methodData = methodData ;
You can’t perform that action at this time.
0 commit comments