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

Add Server Timing information to docs #324

Merged
merged 2 commits into from Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions README.md
Expand Up @@ -1018,7 +1018,8 @@ interface FCPAttribution {
fcpEntry?: PerformancePaintTiming;
/**
* The `navigation` entry of the current page, which is useful for diagnosing
* general page load issues.
* general page load issues. This can be used to access `serverTiming` for example:
* navigationEntry.serverTiming
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be navigationEntry?.serverTiming everywhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A matter of taste. The OptionalChaining ? operator is only needed if navigationEntry is undefined. But I think in terms of docs here it's fine to exclude it.

It could also we used like this without the ?, for example:

const myServerTiming = navigationEntry ? navigationEntry.serverTiming : '(not set)'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phil used it in his example code so probably worth sticking with his preference 😛

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

*/
navigationEntry?: PerformanceNavigationTiming | NavigationTimingPolyfillEntry;
}
Expand Down Expand Up @@ -1129,7 +1130,8 @@ interface LCPAttribution {
elementRenderDelay: number;
/**
* The `navigation` entry of the current page, which is useful for diagnosing
* general page load issues.
* general page load issues. This can be used to access `serverTiming` for example:
* navigationEntry.serverTiming
*/
navigationEntry?: PerformanceNavigationTiming | NavigationTimingPolyfillEntry;
/**
Expand Down Expand Up @@ -1169,8 +1171,9 @@ interface TTFBAttribution {
*/
requestTime: number;
/**
* The `PerformanceNavigationTiming` entry used to determine TTFB (or the
* polyfill entry in browsers that don't support Navigation Timing).
* The `navigation` entry of the current page, which is useful for diagnosing
* general page load issues. This can be used to access `serverTiming` for example:
* navigationEntry.serverTiming
*/
navigationEntry?: PerformanceNavigationTiming | NavigationTimingPolyfillEntry;
}
Expand Down
3 changes: 2 additions & 1 deletion src/types/fcp.ts
Expand Up @@ -52,7 +52,8 @@ export interface FCPAttribution {
fcpEntry?: PerformancePaintTiming;
/**
* The `navigation` entry of the current page, which is useful for diagnosing
* general page load issues.
* general page load issues. This can be used to access `serverTiming` for example:
* navigationEntry.serverTiming
*/
navigationEntry?: PerformanceNavigationTiming | NavigationTimingPolyfillEntry;
}
Expand Down
3 changes: 2 additions & 1 deletion src/types/lcp.ts
Expand Up @@ -66,7 +66,8 @@ export interface LCPAttribution {
elementRenderDelay: number;
/**
* The `navigation` entry of the current page, which is useful for diagnosing
* general page load issues.
* general page load issues. This can be used to access `serverTiming` for example:
* navigationEntry.serverTiming
*/
navigationEntry?: PerformanceNavigationTiming | NavigationTimingPolyfillEntry;
/**
Expand Down
5 changes: 3 additions & 2 deletions src/types/ttfb.ts
Expand Up @@ -52,8 +52,9 @@ export interface TTFBAttribution {
*/
requestTime: number;
/**
* The `PerformanceNavigationTiming` entry used to determine TTFB (or the
* polyfill entry in browsers that don't support Navigation Timing).
* The `navigation` entry of the current page, which is useful for diagnosing
* general page load issues. This can be used to access `serverTiming` for example:
* navigationEntry.serverTiming
*/
navigationEntry?: PerformanceNavigationTiming | NavigationTimingPolyfillEntry;
}
Expand Down