Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove onFID #519

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 3 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ The library supports all of the [Core Web Vitals](https://web.dev/articles/vital

- [First Contentful Paint (FCP)](https://web.dev/articles/fcp)
- [Time to First Byte (TTFB)](https://web.dev/articles/ttfb)
- [First Input Delay (FID)](https://web.dev/articles/fid)

> [!CAUTION]
> FID is deprecated and will be removed in the next major release.

<a name="installation"><a>
<a name="load-the-library"><a>
Expand Down Expand Up @@ -210,8 +206,8 @@ Note that some of these metrics will not report until the user has interacted wi

Also, in some cases a metric callback may never be called:

- FID and INP are not reported if the user never interacts with the page.
- CLS, FCP, FID, and LCP are not reported if the page was loaded in the background.
- INP is not reported if the user never interacts with the page.
- CLS, FCP, and LCP are not reported if the page was loaded in the background.

In other cases, a metric callback may be called more than once:

Expand Down Expand Up @@ -504,7 +500,7 @@ interface Metric {
/**
* The name of the metric (in acronym form).
*/
name: 'CLS' | 'FCP' | 'FID' | 'INP' | 'LCP' | 'TTFB';
name: 'CLS' | 'FCP' | 'INP' | 'LCP' | 'TTFB';

/**
* The current value of the metric.
Expand Down Expand Up @@ -583,18 +579,6 @@ interface FCPMetric extends Metric {
}
```

##### `FIDMetric`

> [!CAUTION]
> This interface is deprecated and will be removed in the next major release.

```ts
interface FIDMetric extends Metric {
name: 'FID';
entries: PerformanceEventTiming[];
}
```

##### `INPMetric`

```ts
Expand Down Expand Up @@ -701,20 +685,6 @@ function onFCP(callback: (metric: FCPMetric) => void, opts?: ReportOpts): void;

Calculates the [FCP](https://web.dev/articles/fcp) value for the current page and calls the `callback` function once the value is ready, along with the relevant `paint` performance entry used to determine the value. The reported value is a [`DOMHighResTimeStamp`](https://developer.mozilla.org/docs/Web/API/DOMHighResTimeStamp).

#### `onFID()`

> [!CAUTION]
> This function is deprecated and will be removed in the next major release.

```ts
function onFID(callback: (metric: FIDMetric) => void, opts?: ReportOpts): void;
```

Calculates the [FID](https://web.dev/articles/fid) value for the current page and calls the `callback` function once the value is ready, along with the relevant `first-input` performance entry used to determine the value. The reported value is a [`DOMHighResTimeStamp`](https://developer.mozilla.org/docs/Web/API/DOMHighResTimeStamp).

> [!IMPORTANT]
> Since FID is only reported after the user interacts with the page, it's possible that it will not be reported for some page loads.

#### `onINP()`

```ts
Expand Down Expand Up @@ -867,41 +837,6 @@ interface FCPAttribution {
}
```

#### `FIDAttribution`

> [!CAUTION]
> This interface is deprecated and will be removed in the next major release.

```ts
interface FIDAttribution {
/**
* A selector identifying the element that the user interacted with. This
* element will be the `target` of the `event` dispatched.
*/
eventTarget: string;
/**
* The time when the user interacted. This time will match the `timeStamp`
* value of the `event` dispatched.
*/
eventTime: number;
/**
* The `type` of the `event` dispatched from the user interaction.
*/
eventType: string;
/**
* The `PerformanceEventTiming` entry corresponding to FID.
*/
eventEntry: PerformanceEventTiming;
/**
* The loading state of the document at the time when the first interaction
* occurred (see `LoadState` for details). If the first interaction occurred
* while the document was loading and executing script (e.g. usually in the
* `dom-interactive` phase) it can result in long input delays.
*/
loadState: LoadState;
}
```

#### `INPAttribution`

```ts
Expand Down Expand Up @@ -1095,7 +1030,6 @@ Browser support for each function is as follows:

- `onCLS()`: Chromium
- `onFCP()`: Chromium, Firefox, Safari
- `onFID()`: Chromium, Firefox _(Deprecated)_
- `onINP()`: Chromium
- `onLCP()`: Chromium, Firefox
- `onTTFB()`: Chromium, Firefox, Safari
Expand Down
9 changes: 0 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
"types": "./dist/modules/onFCP.d.ts",
"default": "./dist/modules/onFCP.js"
},
"./onFID.js": {
"types": "./dist/modules/onFID.d.ts",
"default": "./dist/modules/onFID.js"
},
"./onINP.js": {
"types": "./dist/modules/onINP.d.ts",
"default": "./dist/modules/onINP.js"
Expand All @@ -55,10 +51,6 @@
"types": "./dist/modules/attribution/onFCP.d.ts",
"default": "./dist/modules/attribution/onFCP.js"
},
"./attribution/onFID.js": {
"types": "./dist/modules/attribution/onFID.d.ts",
"default": "./dist/modules/attribution/onFID.js"
},
"./attribution/onINP.js": {
"types": "./dist/modules/attribution/onINP.d.ts",
"default": "./dist/modules/attribution/onINP.js"
Expand Down Expand Up @@ -110,7 +102,6 @@
"Core Web Vitals",
"CLS",
"FCP",
"FID",
"INP",
"LCP",
"TTFB"
Expand Down
26 changes: 0 additions & 26 deletions src/attribution/deprecated.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/attribution/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ export {INPThresholds} from '../onINP.js';
export {LCPThresholds} from '../onLCP.js';
export {TTFBThresholds} from '../onTTFB.js';

export * from './deprecated.js';
export * from '../types.js';
62 changes: 0 additions & 62 deletions src/attribution/onFID.ts

This file was deleted.

23 changes: 0 additions & 23 deletions src/deprecated.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ export {onINP, INPThresholds} from './onINP.js';
export {onLCP, LCPThresholds} from './onLCP.js';
export {onTTFB, TTFBThresholds} from './onTTFB.js';

export * from './deprecated.js';
export * from './types.js';
2 changes: 1 addition & 1 deletion src/lib/polyfills/firstInputPolyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const reportFirstInputDelayIfRecordedAndValid = () => {
* Pointer events can trigger main or compositor thread behavior.
* We differentiate these cases based on whether or not we see a
* 'pointercancel' event, which are fired when we scroll. If we're scrolling
* we don't need to report input delay since FID excludes scrolling and
* we don't need to report input delay since INP excludes scrolling and
* pinch/zooming.
*/
const onPointerDown = (delay: number, event: Event) => {
Expand Down
105 changes: 0 additions & 105 deletions src/onFID.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export * from './types/polyfills.js';

export * from './types/cls.js';
export * from './types/fcp.js';
export * from './types/fid.js';
export * from './types/inp.js';
export * from './types/lcp.js';
export * from './types/ttfb.js';
Expand Down
Loading