UNPKG

1.17 kBTypeScriptView Raw
1import { MetricRatingThresholds, ReportOpts, TTFBMetric } from './types.js';
2/** Thresholds for TTFB. See https://web.dev/articles/ttfb#what_is_a_good_ttfb_score */
3export declare const TTFBThresholds: MetricRatingThresholds;
4/**
5 * Calculates the [TTFB](https://web.dev/articles/ttfb) value for the
6 * current page and calls the `callback` function once the page has loaded,
7 * along with the relevant `navigation` performance entry used to determine the
8 * value. The reported value is a `DOMHighResTimeStamp`.
9 *
10 * Note, this function waits until after the page is loaded to call `callback`
11 * in order to ensure all properties of the `navigation` entry are populated.
12 * This is useful if you want to report on other metrics exposed by the
13 * [Navigation Timing API](https://w3c.github.io/navigation-timing/). For
14 * example, the TTFB metric starts from the page's [time
15 * origin](https://www.w3.org/TR/hr-time-2/#sec-time-origin), which means it
16 * includes time spent on DNS lookup, connection negotiation, network latency,
17 * and server processing time.
18 */
19export declare const onTTFB: (onReport: (metric: TTFBMetric) => void, opts?: ReportOpts) => void;