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

check for getEntriesByName in performance before calling #158

Merged
merged 1 commit into from Jun 2, 2021
Merged
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/getFCP.ts
Expand Up @@ -46,7 +46,7 @@ export const getFCP = (onReport: ReportHandler, reportAllChanges?: boolean) => {

// TODO(philipwalton): remove the use of `fcpEntry` once this bug is fixed.
// https://bugs.webkit.org/show_bug.cgi?id=225305
const fcpEntry = performance.getEntriesByName('first-contentful-paint')[0];
const fcpEntry = 'getEntriesByName' in performance ? performance.getEntriesByName('first-contentful-paint')[0] : null;
const po = fcpEntry ? null : observe('paint', entryHandler);

if (fcpEntry || po) {
Expand Down