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

core(metrics): add FCP metric #4948

Merged
merged 3 commits into from
Apr 10, 2018
Merged

core(metrics): add FCP metric #4948

merged 3 commits into from
Apr 10, 2018

Conversation

patrickhulce
Copy link
Collaborator

progress on #4872

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

LGTM

const Util = require('../report/v2/renderer/util.js');

// eslint-disable-next-line max-len
const LEARN_MORE_LINK = 'https://developers.google.com/web/fundamentals/performance/user-centric-performance-metrics#first_paint_and_first_contentful_paint';
Copy link
Member

Choose a reason for hiding this comment

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

I believe you can just inline this and max-len will accept it since it has a url in it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done


class FirstContentfulPaint extends Audit {
/**
* @return {!AuditMeta}
Copy link
Member

Choose a reason for hiding this comment

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

remove !s

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

/**
* @param {!Artifacts} artifacts
* @param {LH.Audit.Context} context
* @return {!Promise<!AuditResult>}
Copy link
Member

Choose a reason for hiding this comment

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

LH.Artifacts and Promise<LH.Audit.Product> for future us :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

*/
computeObservedMetric(data) {
const {traceOfTab} = data;
if (!traceOfTab) {
Copy link
Member

Choose a reason for hiding this comment

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

hmm, this is kind of unfortunate to check here, but it looks like at least tsc alerts you based on MetricComputationData? Should we always require a trace for ComputedMetric? I assume you made traceOfTab optional for a reason, though

Copy link
Collaborator Author

@patrickhulce patrickhulce Apr 10, 2018

Choose a reason for hiding this comment

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

yeah I just split MetricComputationData into two so we don't have to do this 👍

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

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

lgtm

@patrickhulce patrickhulce changed the title core: add FCP metric core(metrics): add FCP metric Apr 10, 2018
@patrickhulce patrickhulce merged commit aec55bd into master Apr 10, 2018
@patrickhulce patrickhulce deleted the fcp branch April 10, 2018 22:37
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.

4 participants