lighthouse-plugin-publisher-ads/audits/idle-network-times.js
/**
 * Checks if any tag is blocking and therefore causing the idle period in ad
 * loading.
 * @param {IdlePeriod} idlePeriod
 * @param {LH.Artifacts.TagBlockingFirstPaint[]} blockingTags
 * @param {number} pageStartTime
 * @return {boolean} True if the tag caused the idle period, false otherwise.
 */
Checks if any tag is blocking and therefore causing the idle period in ad
loading.
@param {IdlePeriod} idlePeriod
@param {LH.Artifacts.TagBlockingFirstPaint[]} blockingTags
@param {number} pageStartTime
@return {boolean} True if the tag caused the idle period, false otherwise.
Checks if any tag is blocking and therefore causing the idle period in ad loading . @param { IdlePeriod } idlePeriod @param { LH . Artifacts . TagBlockingFirstPaint [] } blockingTags @param { number } pageStartTime @return { boolean } True if the tag caused the idle period false otherwise .
function checkIfTagIsBlocking(idlePeriod, blockingTags, pageStartTime) {
  for (const tag of blockingTags) {
    const shifted = {
      startTime: (tag.startTime - pageStartTime) * 1000,
      endTime: (tag.endTime - pageStartTime) * 1000,
    };
    const overlap = getOverlapTime(shifted, idlePeriod);
    if (overlap / idlePeriod.duration > OVERLAP_THRESHOLD) {
      idlePeriod.cause = Cause.RENDER_BLOCKING_RESOURCE;
      idlePeriod.url = tag.tag.url;
      return true;
    }
  }
  return false;
}
function checkIfTagIsBlocking ( idlePeriod , blockingTags , pageStartTime ) { for ( const tag of blockingTags ) { const shifted = { startTime : ( tag . startTime - pageStartTime ) * 1000 , endTime : ( tag . endTime - pageStartTime ) * 1000 , } ; const overlap = getOverlapTime ( shifted , idlePeriod ) ; if ( overlap / idlePeriod . duration > OVERLAP_THRESHOLD ) { idlePeriod . cause = Cause . RENDER_BLOCKING_RESOURCE ; idlePeriod . url = tag . tag . url ; return true ; } } return false ; }
Checks if any tag is blocking and therefore causing the idle period in ad
 loading.
Checks if any tag is blocking and therefore causing the idle period in ad loading .
// Yes, tag.tag is correct.