@@ -217,10 +217,7 @@ class Driver {
217217 // the global `fileLoader` cache.
218218 this . blobDataCache = { } ;
219219 this . loadCache = { } ;
220- this . counter = { } ;
221- this . counter . loadedResources = 0 ;
222- this . counter . totalResources = 0 ;
223- this . counter . failedPreloadResources = 0 ;
220+ this . counter = { loadedResources : 0 , totalResources : 0 , failedPreloadResources : 0 } ;
224221 }
225222
226223 async start ( ) {
@@ -356,7 +353,7 @@ class Driver {
356353 }
357354 }
358355
359- prepareBrowserUI ( ) {
356+ async prepareBrowserUI ( ) {
360357 let text = "" ;
361358 for ( const benchmark of this . benchmarks )
362359 text += benchmark . renderHTML ( ) ;
@@ -370,15 +367,28 @@ class Driver {
370367 JetStream . start ( ) ;
371368 } ) ;
372369
370+ document . body . classList . add ( "ready" ) ;
373371 const statusElement = document . getElementById ( "status" ) ;
374372 statusElement . innerHTML = `<a href="javascript:JetStream.start()" class="button">Start Test</a>` ;
373+
374+ await this . waitForBrowserUIStartupAnimation ( ) ;
375+
375376 statusElement . addEventListener ( "click" , ( e ) => {
376377 e . preventDefault ( ) ;
377378 JetStream . start ( ) ;
378379 return false ;
379380 } , { once : true } ) ;
380381 }
381382
383+
384+ async waitForBrowserUIStartupAnimation ( ) {
385+ if ( ! JetStreamParams . isDefault )
386+ return
387+ const cssValue = window . getComputedStyle ( document . body ) . getPropertyValue ( "--startup-animation-duration" ) ;
388+ const startupAnimationDuration = parseInt ( cssValue . split ( "ms" ) [ 0 ] )
389+ await new Promise ( ( resolve ) => setTimeout ( resolve , startupAnimationDuration ) ) ;
390+ }
391+
382392 reportError ( benchmark , error ) {
383393 this . pushError ( benchmark . name , error ) ;
384394
@@ -408,7 +418,7 @@ class Driver {
408418 await this . prefetchResources ( ) ;
409419 this . benchmarks . sort ( ( a , b ) => a . plan . name . toLowerCase ( ) < b . plan . name . toLowerCase ( ) ? 1 : - 1 ) ;
410420 if ( isInBrowser )
411- this . prepareBrowserUI ( ) ;
421+ await this . prepareBrowserUI ( ) ;
412422 this . isReady = true ;
413423 if ( isInBrowser ) {
414424 globalThis . dispatchEvent ( new Event ( "JetStreamReady" ) ) ;
@@ -1041,7 +1051,7 @@ class Benchmark {
10411051 updateCounter ( ) {
10421052 const counter = JetStream . counter ;
10431053 ++ counter . loadedResources ;
1044- const statusElement = document . getElementById ( "status" ) ;
1054+ const statusElement = document . getElementById ( "status-counter " ) ;
10451055 statusElement . innerHTML = `Loading ${ counter . loadedResources } of ${ counter . totalResources } ...` ;
10461056 }
10471057
0 commit comments