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

Function maybePumpEarlyFrame

src/runtime.js:510–522  ·  view source on GitHub ↗

* If it makes sense, let the browser paint the current frame before * executing the callback. * @param {!Window} win * @param {function()} cb Callback that should run after a frame was * pumped.

(win, cb)

Source from the content-addressed store, hash-verified

508 * pumped.
509 */
510function maybePumpEarlyFrame(win, cb) {
511 // There is definitely nothing to draw yet, so we might as well
512 // proceed.
513 if (!win.document.body) {
514 cb();
515 return;
516 }
517 if (hasRenderDelayingServices(win)) {
518 cb();
519 return;
520 }
521 Services.timerFor(win).delay(cb, 1);
522}

Callers 1

adoptSharedFunction · 0.85

Calls 3

delayMethod · 0.80
cbFunction · 0.50

Tested by

no test coverage detected