Function getLCP

  • Gets the largest contentful paint (LCP) time of a web page using the Performance API. The LCP time is the time it takes for the largest piece of content to be painted on the screen.


    res => {
    console.log(`LCP: ${res}`);


    LCP: 123

    Returns Promise<number>

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