src/service/performance-impl.js
/**
   * Reports first pain and first contentful paint timings.
   * See https://github.com/WICG/paint-timing
   */
Reports first pain and first contentful paint timings.
Reports first pain and first contentful paint timings .
registerPaintTimingObserver_() {
    if (!this.win.PerformancePaintTiming) {
      return;
    }
    const observer = new this.win.PerformanceObserver(list => {
      list.getEntries().forEach(entry => {
        if (entry.name == 'first-paint') {
          this.tickDelta('fp', entry.startTime + entry.duration);
        }
        else if (entry.name == 'first-contentful-paint') {
          this.tickDelta('fcp', entry.startTime + entry.duration);
        }
      });
    });
    observer.observe({entryTypes: ['paint']});
  }
registerPaintTimingObserver_ ( ) { if ( ! this . win . PerformancePaintTiming ) { return ; } const observer = new this . win . PerformanceObserver ( list => { list . getEntries ( ) . forEach ( entry => { if ( entry . name == 'first-paint' ) { this . tickDelta ( 'fp' , entry . startTime + entry . duration ) ; } else if ( entry . name == 'first-contentful-paint' ) { this . tickDelta ( 'fcp' , entry . startTime + entry . duration ) ; } } ) ; } ) ; observer . observe ( { entryTypes : [ 'paint' ] } ) ; }
Reports first pain and first contentful paint timings.
Reports first pain and first contentful paint timings .