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

Release v1 #84

Merged
merged 13 commits into from
Nov 16, 2020
Merged

Release v1 #84

merged 13 commits into from
Nov 16, 2020

Conversation

philipwalton
Copy link
Member

@philipwalton philipwalton commented Nov 10, 2020

The branch in this PR will be used to track changes for the v1 release.

Fixes #29, fixes #55, fixes #75, fixes #82, #fixes #83

@philipwalton philipwalton self-assigned this Nov 10, 2020
README.md Outdated
- FID can be measured in all browsers.
- FCP, FID, and LCP will be more accurate in some cases (since the polyfill detects the page's initial `visibilityState` earlier).

Also, the minimal polyfill to support back/forward cache restores that is found in the "full" version is largely the same as the code used in the `polyfill.js` script—just split out. This means that using the polyfill gets you wider browser support and more accurate results with almost no increased code cost (just increased implementation complexity).
Copy link
Contributor

Choose a reason for hiding this comment

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

This confused me a bit :)

There's a built-in polyfill in the "full" version that is pretty much the same as polyfill.js, but using "base" + polyfill.js provides better browser support and accuracy? Maybe add a one-liner to explain why?

Copy link
Contributor

Choose a reason for hiding this comment

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

Now that I understand, I think the term "full" is what makes it confusing. It makes it seem like it has everything (back-forward cache restores and FID polyfill)

Changing it to something else should make things clearer 🚀

All other usage instructions (as well as the public API) are the same in both versions.

_**Note:** while it's certainly possible to copy and paste the code in `polyfill.js` directly into your templates (for step #1 above), it's better to automate this within your build process—otherwise you risk the polyfill and base scripts getting out of sync when new versions are released._

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this section could/should be moved up to the Usage section? For example, something like:


Usage

There are two ways to use the web-vitals library on your site.

1. Use the "full" version

import {getLCP, getFID, getCLS} from 'web-vitals';

...

2. Use the "base" version with polyfill.js

In your application code, import the "base" build rather than the "full" build. To do this, change any import statements to reference web-vitals/base rather than web-vitals:

- import {getLCP, getFID, getCLS} from 'web-vitals';
+ import {getLCP, getFID, getCLS} from 'web-vitals/base';

Then inline the code from dist/polyfill.js into the <head> of your pages.

<!DOCTYPE html>
<html>
  <head>
    <script>
      // Inline code from `dist/polyfill.js` here
    </script>
  </head>
  <body>
    ...
  </body>
</html>

See Which bundle is right for you? for the differences between the two options.

Copy link
Contributor

Choose a reason for hiding this comment

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

Feel free to ignore of course if you would rather not move the section up

README.md Outdated Show resolved Hide resolved
Co-authored-by: Houssein Djirdeh <houssein@google.com>
@philipwalton philipwalton merged commit bebca81 into master Nov 16, 2020
@philipwalton philipwalton changed the title [WIP] Release v1 Release v1 Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment