lighthouse-plugin-publisher-ads/audits/idle-network-times.js
/**
 * Checks waiting on load events is the cause of the idle period.
 * @param {IdlePeriod} idlePeriod
 * @param {LH.Artifacts.NavigationTraceTimes} timings
 * @return {boolean} True if waiting on load is the suspected cause, false
 *     otherwise.
 */
Checks waiting on load events is the cause of the idle period.
@param {IdlePeriod} idlePeriod
@param {LH.Artifacts.NavigationTraceTimes} timings
@return {boolean} True if waiting on load is the suspected cause, false
otherwise.
Checks waiting on load events is the cause of the idle period . @param { IdlePeriod } idlePeriod @param { LH . Artifacts . NavigationTraceTimes } timings @return { boolean } True if waiting on load is the suspected cause false otherwise .
function checkIfLoadIsBlocking(idlePeriod, timings) {
  if (timings.domContentLoaded &&
      idlePeriod.endTime > timings.domContentLoaded &&
      idlePeriod.endTime - timings.domContentLoaded < PROXIMITY_MS_THRESHOLD) {
    idlePeriod.cause = Cause.DOM_CONTENT_LOADED;
    return true;
  }
  if (timings.load && idlePeriod.endTime > timings.load &&
      idlePeriod.endTime - timings.load < PROXIMITY_MS_THRESHOLD) {
    idlePeriod.cause = Cause.LOAD_EVENT;
    return true;
  }
  return false;
}
function checkIfLoadIsBlocking ( idlePeriod , timings ) { if ( timings . domContentLoaded && idlePeriod . endTime > timings . domContentLoaded && idlePeriod . endTime - timings . domContentLoaded < PROXIMITY_MS_THRESHOLD ) { idlePeriod . cause = Cause . DOM_CONTENT_LOADED ; return true ; } if ( timings . load && idlePeriod . endTime > timings . load && idlePeriod . endTime - timings . load < PROXIMITY_MS_THRESHOLD ) { idlePeriod . cause = Cause . LOAD_EVENT ; return true ; } return false ; }
Checks waiting on load events is the cause of the idle period.
Checks waiting on load events is the cause of the idle period .
// TODO(warrengm): Attribute this to the script that installed the load // event listener. // TODO(warrengm): Attribute this to the script that installed the load // event listener.