File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -47,23 +47,27 @@ class GUI extends React.Component {
4747 this . audioEngine = new AudioEngine ( ) ;
4848 this . props . vm . attachAudioEngine ( this . audioEngine ) ;
4949 this . props . vm . initialized = true ;
50- const fontPromises = [ ] ;
51- if ( document . fonts &&
52- typeof document . fonts . values === 'function' &&
53- typeof document . fonts . values ( ) [ Symbol . iterator ] === 'function' ) {
54- for ( const fontFace of document . fonts . values ( ) ) {
55- fontPromises . push ( fontFace . loaded ) ;
56- fontFace . load ( ) ;
50+
51+ const getFontPromises = ( ) => {
52+ const fontPromises = [ ] ;
53+ if ( document . fonts &&
54+ typeof document . fonts . values === 'function' &&
55+ typeof document . fonts . values ( ) [ Symbol . iterator ] === 'function' ) {
56+ for ( const fontFace of document . fonts . values ( ) ) {
57+ fontPromises . push ( fontFace . loaded ) ;
58+ fontFace . load ( ) ;
59+ }
5760 }
58- }
61+ return fontPromises ;
62+ } ;
5963
6064 if ( document . readyState === 'complete' ) {
61- Promise . all ( fontPromises ) . then ( this . loadProject ) ;
65+ Promise . all ( getFontPromises ( ) ) . then ( this . loadProject ) ;
6266 } else {
6367 document . onreadystatechange = ( ) => {
6468 if ( document . readyState !== 'complete' ) return ;
6569 document . onreadystatechange = null ;
66- Promise . all ( fontPromises ) . then ( this . loadProject ) ;
70+ Promise . all ( getFontPromises ( ) ) . then ( this . loadProject ) ;
6771 } ;
6872 }
6973 }
You can’t perform that action at this time.
0 commit comments