Skip to content

Commit

Permalink
Add exra guard for PerformanceEventTiming not existing (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
tunetheweb committed Dec 27, 2023
1 parent d44362e commit e07c7a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/onINP.ts
Expand Up @@ -220,7 +220,10 @@ export const onINP = (onReport: INPReportCallback, opts?: ReportOpts) => {
// If browser supports interactionId (and so supports INP), also
// observe entries of type `first-input`. This is useful in cases
// where the first interaction is less than the `durationThreshold`.
if ('interactionId' in PerformanceEventTiming.prototype) {
if (
'PerformanceEventTiming' in window &&
'interactionId' in PerformanceEventTiming.prototype
) {
po.observe({type: 'first-input', buffered: true});
}

Expand Down

0 comments on commit e07c7a7

Please sign in to comment.