-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ecb4bd0
commit c696eb8
Showing
5 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const image = document.createElement('img'); | ||
image.src = 'lcp-image.jpg'; | ||
document.body.appendChild(image); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<html> | ||
<head> | ||
<title>LCP Discovery Delay</title> | ||
<script src="./render-blocking-script.js"></script> | ||
</head> | ||
<body> | ||
<p>In this example the LCP image is discovered late because:</p> | ||
<ul> | ||
<li> | ||
The page has a render blocking script with a sync <code>sleep()</code> call for 1 second. | ||
</li> | ||
<li>The <code>app.js</code> script is the one that injects the LCP image..</li> | ||
</ul> | ||
<script src="./app.js"></script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function sleepFor(sleepDuration) { | ||
let now = new Date().getTime(); | ||
while (new Date().getTime() < now + sleepDuration) {} | ||
} | ||
sleepFor(1_000); |