UNPKG

1.85 kBTypeScriptView Raw
1import { INPMetric, MetricRatingThresholds, ReportOpts } from './types.js';
2/** Thresholds for INP. See https://web.dev/articles/inp#what_is_a_good_inp_score */
3export declare const INPThresholds: MetricRatingThresholds;
4/**
5 * Calculates the [INP](https://web.dev/articles/inp) value for the current
6 * page and calls the `callback` function once the value is ready, along with
7 * the `event` performance entries reported for that interaction. The reported
8 * value is a `DOMHighResTimeStamp`.
9 *
10 * A custom `durationThreshold` configuration option can optionally be passed to
11 * control what `event-timing` entries are considered for INP reporting. The
12 * default threshold is `40`, which means INP scores of less than 40 are
13 * reported as 0. Note that this will not affect your 75th percentile INP value
14 * unless that value is also less than 40 (well below the recommended
15 * [good](https://web.dev/articles/inp#what_is_a_good_inp_score) threshold).
16 *
17 * If the `reportAllChanges` configuration option is set to `true`, the
18 * `callback` function will be called as soon as the value is initially
19 * determined as well as any time the value changes throughout the page
20 * lifespan.
21 *
22 * _**Important:** INP should be continually monitored for changes throughout
23 * the entire lifespan of a page—including if the user returns to the page after
24 * it's been hidden/backgrounded. However, since browsers often [will not fire
25 * additional callbacks once the user has backgrounded a
26 * page](https://developer.chrome.com/blog/page-lifecycle-api/#advice-hidden),
27 * `callback` is always called when the page's visibility state changes to
28 * hidden. As a result, the `callback` function might be called multiple times
29 * during the same page load._
30 */
31export declare const onINP: (onReport: (metric: INPMetric) => void, opts?: ReportOpts) => void;