Gets the first contentful paint (FCP) time of a web page using the Performance API. The FCP time is the time it takes for the first piece of content to be painted on the screen.
Usage:
getFCP().then( res => { console.log(`FCP: ${res}`); }); Copy
getFCP().then( res => { console.log(`FCP: ${res}`); });
Output:
FCP: 123 Copy
FCP: 123
A promise that resolves with the FCP time in milliseconds, or 0 if the 'paint' entry type is not supported.
Gets the first contentful paint (FCP) time of a web page using the Performance API. The FCP time is the time it takes for the first piece of content to be painted on the screen.
Usage:
Output: