MCPcopy Index your code
hub / github.com/ampproject/amphtml / minTime

Function minTime

3p/environment.js:247–257  ·  view source on GitHub ↗

* Calculates the minimum time that a timeout should have right now. * @param {number|undefined} time * @return {number|undefined}

(time)

Source from the content-addressed store, hash-verified

245 * @return {number|undefined}
246 */
247function minTime(time) {
248 if (!inViewport) {
249 time += 1000;
250 }
251 // Eventually this should throttle like this:
252 // - for timeouts in the order of a frame use requestAnimationFrame
253 // instead.
254 // - only allow about 2-4 short timeouts (< 16ms) in a 16ms time frame.
255 // Throttle further timeouts to requestAnimationFrame.
256 return time;
257}
258
259/**
260 * Installs embed state listener.

Callers 1

instrumentEntryPointsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected