MCPcopy
hub / github.com/Zizzamia/perfume.js / Metric

Interface Metric

src/types.ts:3–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1import type { ReportOpts } from 'web-vitals';
2
3export interface Metric {
4 /**
5 * The name of the metric (in acronym form).
6 */
7 name:
8 | 'CLS'
9 | 'FCP'
10 | 'FID'
11 | 'INP'
12 | 'LCP'
13 | 'TTFB'
14 | 'RT'
15 | 'TBT'
16 | 'NTBT'
17 | 'ET'
18 | 'INP';
19 /**
20 * The current value of the metric.
21 */
22 value: number;
23 /**
24 * The rating as to whether the metric value is within the "good",
25 * "needs improvement", or "poor" thresholds of the metric.
26 */
27 rating: IVitalsScore;
28 /**
29 * The delta between the current value and the last-reported value.
30 * On the first report, `delta` and `value` will always be the same.
31 */
32 delta?: number;
33 /**
34 * A unique ID representing this particular metric instance. This ID can
35 * be used by an analytics tool to dedupe multiple values sent for the same
36 * metric instance, or to group multiple deltas together and calculate a
37 * total. It can also be used to differentiate multiple different metric
38 * instances sent from the same page, which can happen if the page is
39 * restored from the back/forward cache (in that case new metrics object
40 * get created).
41 */
42 id?: string;
43 /**
44 * Any performance entries relevant to the metric value calculation.
45 * The array may also be empty if the metric value was not based on any
46 * entries (e.g. a CLS value of 0 given no layout shifts).
47 */
48 entries?: PerformanceEntry[];
49 /**
50 * The type of navigation
51 *
52 * Navigation Timing API (or `undefined` if the browser doesn't
53 * support that API). For pages that are restored from the bfcache, this
54 * value will be 'back-forward-cache'.
55 */
56 navigationType?: INavigationType;
57
58 /**
59 * An object containing potentially-helpful debugging information that
60 * can be sent along with the metric value for the current page visit in

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected