You could style the opacity
<https://developer.mozilla.org/en-US/docs/Web/CSS/opacity> of your <body>
element to 0, then load your image, and then turn the opacity to 1 with JS.

On Sun, Nov 27, 2022 at 11:57 PM Hao Liu <haol...@chromium.org> wrote:

> Hi,
> I want a LCP entry that has loadTime < FCP, but can't make it.
>
> what I did is
> // Load the image
> await new Promise(function (resolve, reject) {
> let image = new Image();
> image.addEventListener('load', () => { resolve(image);
> console.log('Resolve Time', performance.now()); });
> image.addEventListener('error', reject);
> image.src = url;
> image.setAttribute('decoding', 'sync');
> });
>
> // Add a text so that FCP is set.
> const paragraph = document.createElement('p');
> paragraph.innerHTML = text;
> document.body.appendChild(paragraph);
>
> //Attach Image
> document.body.appendChild(img);
>
> // Get the LCP entry corresponding to the image
> lcp = await getLCPStartTime();
> fcp = getFCPStartTime();
>
> But the LCP.loadTime is not the one printed out when the promise resolves
> and is larger than FCP.
> Is this expected behavior?
> or
> Is there a way to force the LCP.loadTime < FCP and RenderTime>FCP?
>
> Thanks!
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "blink-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to blink-dev+unsubscr...@chromium.org.
> To view this discussion on the web visit
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/ece19d26-cea8-48fb-b3f1-677012785433n%40chromium.org
> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/ece19d26-cea8-48fb-b3f1-677012785433n%40chromium.org?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to blink-dev+unsubscr...@chromium.org.
To view this discussion on the web visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAL5BFfUE8vSLPYC%3DYjwMBnrErx3WOOxDybQMPC_%3DPpSw%3D2YP6Q%40mail.gmail.com.

Reply via email to