MCPcopy
hub / github.com/ampproject/amphtml / tickSinceVisible

Method tickSinceVisible

src/service/performance-impl.js:862–874  ·  view source on GitHub ↗

* Tick time delta since the document has become visible. * @param {TickLabel_Enum} label The variable name as it will be reported. * @param {number=} opt_delta The optional delta value in milliseconds.

(label, opt_delta)

Source from the content-addressed store, hash-verified

860 * @param {number=} opt_delta The optional delta value in milliseconds.
861 */
862 tickSinceVisible(label, opt_delta) {
863 const delta =
864 opt_delta == undefined ? this.win.performance.now() : opt_delta;
865 const end = this.timeOrigin_ + delta;
866
867 // If on Origin, use timeOrigin
868 // If in a viewer, use firstVisibleTime
869 const visibleTime = this.viewer_?.isEmbedded()
870 ? this.ampdoc_?.getFirstVisibleTime()
871 : this.timeOrigin_;
872 const v = visibleTime ? Math.max(end - visibleTime, 0) : 0;
873 this.tickDelta(label, v);
874 }
875
876 /**
877 * Ask the viewer to flush the ticks

Callers 4

processEntryMethod · 0.95
constructorMethod · 0.80

Calls 4

tickDeltaMethod · 0.95
nowMethod · 0.80
isEmbeddedMethod · 0.45
getFirstVisibleTimeMethod · 0.45

Tested by

no test coverage detected