File tree 1 file changed +10
-14
lines changed 1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change 1
1
( function ( ) {
2
- // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceServerTiming
3
- const entries = window . performance . getEntriesByType ( 'resource' ) ;
4
- if ( entries . length > 0 && entries [ 0 ] . serverTiming ) {
5
- const timings = entries [ 0 ] . serverTiming ;
6
- const serverTimings = [ ] ;
7
- for ( let timing of timings ) {
8
- serverTimings . push ( {
9
- name : timing . name ,
10
- duration : timing . duration ,
11
- description : timing . description
12
- } ) ;
13
- }
14
- return serverTimings ;
15
- } else return undefined ;
2
+ let t = window . performance . getEntriesByType ( 'navigation' ) [ 0 ] ;
3
+ const serverTimings = [ ] ;
4
+ for ( let timing of t . serverTiming ) {
5
+ serverTimings . push ( {
6
+ name : timing . name ,
7
+ duration : timing . duration ,
8
+ description : timing . description
9
+ } ) ;
10
+ }
11
+ return serverTimings ;
16
12
} ) ( ) ;
You can’t perform that action at this time.
0 commit comments