blob: 94185eab34692d9d58f558997e7913f4190d9170 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<!DOCTYPE html>
<div id="main">
<svg viewBox="0 0 10 10">
<defs>
<circle id="myCircle" cx="5" cy="5" r="4" stroke="blue" />
</defs>
<use id="circle" href="#myCircle" fill="green" />
</svg>
</div>
<script>
const observer = new PerformanceObserver(list => {
const fcp = list.getEntriesByName("first-contentful-paint");
if (!fcp.length)
return;
// Message the parent when FCP has been reached.
parent.postMessage("GotFCP", '*');
});
observer.observe({ type: "paint", buffered: true });
</script>
|