File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,16 @@ export const onINP = (
64
64
onReport : ( metric : INPMetric ) => void ,
65
65
opts ?: ReportOpts ,
66
66
) => {
67
+ // Return if the browser doesn't support all APIs needed to measure INP.
68
+ if (
69
+ ! (
70
+ 'PerformanceEventTiming' in self &&
71
+ 'interactionId' in PerformanceEventTiming . prototype
72
+ )
73
+ ) {
74
+ return ;
75
+ }
76
+
67
77
// Set defaults
68
78
opts = opts || { } ;
69
79
@@ -104,15 +114,9 @@ export const onINP = (
104
114
) ;
105
115
106
116
if ( po ) {
107
- // If browser supports interactionId (and so supports INP), also
108
- // observe entries of type `first-input`. This is useful in cases
117
+ // Also observe entries of type `first-input`. This is useful in cases
109
118
// where the first interaction is less than the `durationThreshold`.
110
- if (
111
- 'PerformanceEventTiming' in self &&
112
- 'interactionId' in PerformanceEventTiming . prototype
113
- ) {
114
- po . observe ( { type : 'first-input' , buffered : true } ) ;
115
- }
119
+ po . observe ( { type : 'first-input' , buffered : true } ) ;
116
120
117
121
onHidden ( ( ) => {
118
122
handleEntries ( po . takeRecords ( ) as INPMetric [ 'entries' ] ) ;
You can’t perform that action at this time.
0 commit comments