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 a config object param to all metric functions #225

Merged
merged 1 commit into from May 11, 2022
Merged

Conversation

philipwalton
Copy link
Member

Fixes #224 by adding a optional, configuration object as the second parameter for all metric function.

This PR also adds the ability to set the durationThreshold parameter when measuring INP, which is useful if you to get more granular debug data on interactions that are already relatively fast (the default durationThreshold is 40).

Here's an example of how you can set the lowest supported durationThreshold value supported in browsers.

import {onINP} from 'web-vitals';

onINP(console.log, {
  durationThreshold: 16,
  reportAllChanges: true,
});

@philipwalton philipwalton merged commit dfa25bc into next May 11, 2022
@philipwalton philipwalton deleted the config-opts branch May 11, 2022 18:30
@rviscomi
Copy link
Member

Should the WV extension use this? Not sure if it would help clear the "waiting for interaction" message sooner.

@philipwalton
Copy link
Member Author

Yeah, it potentially could. The main unknown is what the performance impact is of setting to a lower threshold actually is. @mmocny is planning to run some benchmarks.

@rviscomi
Copy link
Member

Is there an issue I can subscribe to where that's being tracked?

@mmocny
Copy link
Member

mmocny commented May 11, 2022

https://bugs.chromium.org/p/chromium/issues/detail?id=1321807

Not sure how highly to prioritize that work. Let us know demand in the bug :)

@rviscomi
Copy link
Member

Thanks. The reporting lag in the extension did throw me off, but I'll let you know if there's additional developer feedback to make this a higher priority.

We can also make the duration threshold configurable in the extension options, so developers can choose to trade performance for better reporting.

@mmocny
Copy link
Member

mmocny commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants