GoogleChrome / web-vitals

Essential metrics for a healthy site.
https://web.dev/vitals
Apache License 2.0
7.59k stars 415 forks source link

onINP: PerformanceEventTiming is not defined in Firefox 88- #402

Closed steffenweber closed 10 months ago

steffenweber commented 11 months ago

Calling onINP triggers a JavaScript error in Firefox 88 (and older). It's totally fine that this library doesn't (fully) support older browsers, of course, but maybe throwing this JavaScript error could be avoided.

Reduced test-case:

<script type="module">
import {onINP} from 'https://unpkg.com/web-vitals@3?module';
onINP(console.log, true);
</script>

Resulting error:

Uncaught ReferenceError: PerformanceEventTiming is not defined
    Q https://unpkg.com/web-vitals@3?module:1
    C https://unpkg.com/web-vitals@3?module:1
    Q https://unpkg.com/web-vitals@3?module:1
    <anonymous> test.html:3