Skip to content

Commit 3906dee

Browse files
committed
tti: simplify logic grabbing 85% vis complete
1 parent 1c62db3 commit 3906dee

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lighthouse-core/audits/time-to-interactive.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,17 @@ class TTIMetric extends Audit {
7979
const fMPts = timings.fMPfull + timings.navStart;
8080

8181
// look at speedline results for 85% starting at FMP
82-
let eightyFivePctVC;
8382
let visuallyReadyTiming = 0;
8483

8584
if (artifacts.Speedline.frames) {
86-
eightyFivePctVC = artifacts.Speedline.frames.find(frame => {
85+
const eightyFivePctVC = artifacts.Speedline.frames.find(frame => {
8786
return frame.getTimeStamp() >= fMPts && frame.getProgress() >= 85;
8887
});
8988

90-
// Check to avoid closure compiler null dereferencing errors
91-
if (eightyFivePctVC === undefined) {
92-
eightyFivePctVC = 0;
89+
if (eightyFivePctVC) {
90+
// TODO CHECK these units are the same
91+
visuallyReadyTiming = eightyFivePctVC.getTimeStamp() - timings.navStart;
9392
}
94-
95-
// TODO CHECK these units are the same
96-
visuallyReadyTiming = eightyFivePctVC.getTimeStamp() - timings.navStart || 0;
9793
}
9894

9995
// Find first 500ms window where Est Input Latency is <50ms at the 90% percentile.

0 commit comments

Comments
 (0)