Skip to content

Commit 5bcfb0f

Browse files
committed
feat: add onTTI declaration
1 parent d757b0c commit 5bcfb0f

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 1.0.0 (2023-09-25)
1+
# 0.0.4 (2023-09-25)
22

33

44
### Features

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,24 @@ Easily measure performance metrics of time to interactive in JavaScript.
1010
npm i @inchill/time-to-interactive
1111
```
1212

13+
Or
14+
15+
```shell
16+
yarn add @inchill/time-to-interactive
17+
```
18+
1319
```js
1420
import { onTTI } from '@inchill/time-to-interactive';
1521

1622
onTTI(res => console.log(res));
1723
```
1824

25+
26+
1927
## Browser Support
2028

2129
The `time-to-interactive` code will run without error in all major browsers as well as Internet Explorer back to version 11. So, `onTTI` is currently only available in Chromium-based browsers (e.g. Chrome, Edge, Opera, Samsung Internet).
2230

23-
## Development
24-
2531
## License
2632

2733
[MIT](/LICENSE)

types/index.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,11 @@ export interface TTIMetric extends Metric {
4343
export interface TTIReportCallback {
4444
(metric: Metric): void;
4545
}
46+
47+
/**
48+
* Calculates the [TTI](https://web.dev/tti/) value for the current page and
49+
* calls the `callback` function once the value is ready, along with the
50+
* relevant `paint` performance entry used to determine the value. The reported
51+
* value is a `DOMHighResTimeStamp`.
52+
*/
53+
export declare const onTTI: (onReport: TTIReportCallback) => void;

0 commit comments

Comments
 (0)