HTML 5 Progress Element Depends on Activity

I want to display an undefined progress bar while my JavaScript application is doing some initialization, for example. loading a JSON object using apch. Unfortunately, any activity blocks the progress bar on Firefox 52 64 Bit in Gnome 3.16.4, which can lead to a reboot of my users, as they suggest that the application crashed.

As MWE, I use a lot of console.log calls to emulate initialization, which also leads to a blocked progress bar:

 <html> <head><meta charset="utf-8"></head> <body style="width:99%;height:1000px;"> <progress style="width:99%;position:absolute;top:50%;height:20px;"></progress> <script> for(i=0;i<100000;i++) {console.log("nop");} </script> </body> </html> 

How can I achieve a non-freezing progress bar during activity?

+5
source share
1 answer

try as follows:

  function print(){ return new Promise((resolve,reject)=>{ console.log('nop'); resolve(true); }); } async function go(){ for(i=0;i<100000;i++) { await print(); } } go(); 
 <progress style="width:100%;height:20px;"></progress> 
0
source

Source: https://habr.com/ru/post/1268359/


All Articles