Function getFCP

  • 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}`);
    }
    );

    Output:

    FCP: 123
    

    Returns Promise<number>

    A promise that resolves with the FCP time in milliseconds, or 0 if the 'paint' entry type is not supported.