-
Notifications
You must be signed in to change notification settings - Fork 485
Description
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.