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

Function pollForLayout

testing/iframe.js:495–516  ·  view source on GitHub ↗
(win, count, opt_timeout)

Source from the content-addressed store, hash-verified

493 * @return {!Promise}
494 */
495export function pollForLayout(win, count, opt_timeout) {
496 const getCount = () => {
497 return win.document.querySelectorAll('.i-amphtml-layout,.i-amphtml-error')
498 .length;
499 };
500 return poll(
501 'Waiting for elements to layout: ' + count,
502 () => {
503 return getCount() >= count;
504 },
505 () => {
506 return new Error(
507 'Failed to find elements with layout.' +
508 ' Current count: ' +
509 getCount() +
510 ' HTML:\n' +
511 win.document.documentElement./*TEST*/ innerHTML
512 );
513 },
514 opt_timeout
515 );
516}
517
518/**
519 * @param {!Window} win

Callers 2

runTestFunction · 0.90

Calls 2

getCountFunction · 0.85
pollFunction · 0.70

Tested by

no test coverage detected