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

The getXXX names are confusing #217

Closed
philipwalton opened this issue Apr 23, 2022 · 0 comments
Closed

The getXXX names are confusing #217

philipwalton opened this issue Apr 23, 2022 · 0 comments
Milestone

Comments

@philipwalton
Copy link
Member

In the first design of this library, the getXXX() functions returned a promise that would resolve once the metric value was known. However, as these metrics evolved to measure more of the page lifecycle—and include things like re-reporting after a bfcache restore—the promise design was no longer possible and we switched to the callback-based approach we have now.

Unfortunately, the continued use of "get" in the function names kinda implies that these functions return something (which they don't) and it also doesn't make it clear that the functions can be invoked multiple times (which they can).

I've seen a number of libraries wrap this library and rename the functions to onXXX(), which I think makes more sense given the current API design.

We should consider making that switch as well. To avoid/minimize breakage, we could alias the names for one major version and then remove them aftward.

@philipwalton philipwalton added this to the v3 milestone Apr 23, 2022
@GoogleChrome GoogleChrome deleted a comment from anprettyboy Nov 14, 2024
@GoogleChrome GoogleChrome locked and limited conversation to collaborators Nov 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant