UNPKG

1.6 kBTypeScriptView Raw
1import type { LoadState, Metric } from './base.js';
2/**
3 * An FCP-specific version of the Metric object.
4 */
5export interface FCPMetric extends Metric {
6 name: 'FCP';
7 entries: PerformancePaintTiming[];
8}
9/**
10 * An object containing potentially-helpful debugging information that
11 * can be sent along with the FCP value for the current page visit in order
12 * to help identify issues happening to real-users in the field.
13 */
14export interface FCPAttribution {
15 /**
16 * The time from when the user initiates loading the page until when the
17 * browser receives the first byte of the response (a.k.a. TTFB).
18 */
19 timeToFirstByte: number;
20 /**
21 * The delta between TTFB and the first contentful paint (FCP).
22 */
23 firstByteToFCP: number;
24 /**
25 * The loading state of the document at the time when FCP `occurred (see
26 * `LoadState` for details). Ideally, documents can paint before they finish
27 * loading (e.g. the `loading` or `dom-interactive` phases).
28 */
29 loadState: LoadState;
30 /**
31 * The `PerformancePaintTiming` entry corresponding to FCP.
32 */
33 fcpEntry?: PerformancePaintTiming;
34 /**
35 * The `navigation` entry of the current page, which is useful for diagnosing
36 * general page load issues. This can be used to access `serverTiming` for example:
37 * navigationEntry?.serverTiming
38 */
39 navigationEntry?: PerformanceNavigationTiming;
40}
41/**
42 * An FCP-specific version of the Metric object with attribution.
43 */
44export interface FCPMetricWithAttribution extends FCPMetric {
45 attribution: FCPAttribution;
46}