File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
packages/react-devtools-extensions/src/parseHookNames Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -451,32 +451,48 @@ function extractAndLoadSourceMaps(
451
451
}
452
452
453
453
function fetchFile ( url : string ) : Promise < string > {
454
+ if ( __PERFORMANCE_PROFILE__ ) {
455
+ mark ( 'fetchFile ( "' + url + '") ') ;
456
+ }
457
+
454
458
return new Promise ( ( resolve , reject ) => {
455
459
fetch ( url ) . then (
456
460
response => {
457
461
if ( response . ok ) {
458
462
response
459
463
. text ( )
460
464
. then ( text => {
465
+ if ( __PERFORMANCE_PROFILE__ ) {
466
+ measure ( 'fetchFile("' + url + '")' ) ;
467
+ }
461
468
resolve ( text ) ;
462
469
} )
463
470
. catch ( error => {
464
471
if ( __DEBUG__ ) {
465
472
console . log ( `fetchFile() Could not read text for url "${ url } "` ) ;
466
473
}
474
+ if ( __PERFORMANCE_PROFILE__ ) {
475
+ measure ( 'fetchFile("' + url + '")' ) ;
476
+ }
467
477
reject ( null ) ;
468
478
} ) ;
469
479
} else {
470
480
if ( __DEBUG__ ) {
471
481
console . log ( `fetchFile() Got bad response for url "${ url } "` ) ;
472
482
}
483
+ if ( __PERFORMANCE_PROFILE__ ) {
484
+ measure ( 'fetchFile("' + url + '")' ) ;
485
+ }
473
486
reject ( null ) ;
474
487
}
475
488
} ,
476
489
error => {
477
490
if ( __DEBUG__ ) {
478
491
console . log ( `fetchFile() Could not fetch file: ${ error . message } ` ) ;
479
492
}
493
+ if ( __PERFORMANCE_PROFILE__ ) {
494
+ measure ( 'fetchFile("' + url + '")' ) ;
495
+ }
480
496
reject ( null ) ;
481
497
} ,
482
498
) ;
You can’t perform that action at this time.
0 commit comments