const waitLoad = ( statusFunc )=>{ var imagesLoaded=false; var fontsLoaded=false; let interval = setInterval(()=>{ fontsLoaded = fontsLoaded || document.fonts.ready; imagesLoaded = imagesLoaded || ([...document.images].filter(el => !el.complete).length == 0); statusFunc( fontsLoaded && imagesLoaded ); if (fontsLoaded && imagesLoaded) clearInterval(interval); }, 500); } // use waitLoad( ( state ) => console.log(state) )