@@ -268,11 +268,13 @@ class PyodideRuntime extends Runtime {
268
268
The core PyScript app definition.
269
269
******************************************************************************/
270
270
const main = function ( ) {
271
+ // Used to measure start-up times.
272
+ const start = new Date ( ) ;
271
273
// Really simple logging. Emoji 🐍 highlights PyScript app logs. ;-)
272
274
const logger = function ( ) {
273
275
return Function . prototype . bind . call ( console . log , console , "🐍 " , ...arguments ) ;
274
276
} ( ) ;
275
- logger ( "Starting PyScript. 👋" )
277
+ logger ( "Starting PyScript. 👋" , start ) ;
276
278
277
279
// Default configuration settings for PyScript. These may be overridden by
278
280
// the app.loadConfig function.
@@ -309,7 +311,7 @@ const main = function() {
309
311
// Flag to indicate the runtime is ready to evaluate scripts.
310
312
let runtimeReady = false ;
311
313
312
- // To hold a reference to the div containing the start-up splash animation
314
+ // To hold a reference to the div containing the start-up splash screen
313
315
// displayed while PyScript starts up.
314
316
let splashElement = null ;
315
317
@@ -343,7 +345,6 @@ const main = function() {
343
345
splashElement . innerHTML = config . splash ;
344
346
const body = document . getElementsByTagName ( 'body' ) [ 0 ] ;
345
347
body . appendChild ( splashElement ) ;
346
-
347
348
} ,
348
349
splashOff : function ( ) {
349
350
/*
@@ -383,7 +384,8 @@ const main = function() {
383
384
const runtimeElement = document . createElement ( "script" ) ;
384
385
runtimeElement . src = runtimes [ runtimeName . toLowerCase ( ) ] . url ;
385
386
runtimeElement . onload = function ( e ) {
386
- logger ( `Runtime "${ runtimeName } " loaded. 👍` )
387
+ let duration = new Date ( ) - start ;
388
+ logger ( `Runtime "${ runtimeName } " loaded (${ duration } ms). 👍` ) ;
387
389
const pyRuntimeLoaded = new CustomEvent ( "py-runtime-loaded" , { detail : runtimeName } ) ;
388
390
document . dispatchEvent ( pyRuntimeLoaded ) ;
389
391
} ;
@@ -405,7 +407,8 @@ const main = function() {
405
407
through each registered plugin's onRuntimeReady method, and begin
406
408
evaluating any code in the pendingScripts queue.
407
409
*/
408
- logger ( `Runtime started. 🎬` )
410
+ let duration = new Date ( ) - start ;
411
+ logger ( `Runtime started (${ duration } ms). 🎬` ) ;
409
412
runtimeReady = true ;
410
413
plugins . forEach ( function ( plugin ) {
411
414
plugin . onRuntimeReady ( config , runtime ) ;
0 commit comments