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

Method startRender_

src/friendly-iframe-embed.js:500–542  ·  view source on GitHub ↗

* @private * @restricted

()

Source from the content-addressed store, hash-verified

498 * @restricted
499 */
500 startRender_() {
501 if (this.host) {
502 this.host.renderStarted();
503 } else {
504 this.signals_.signal(CommonSignals_Enum.RENDER_START);
505 }
506
507 // TODO(ccordry): remove when no-signing launched.
508 if (!this.spec.skipHtmlMerge) {
509 // When not streaming renderStart signal is good enough.
510 this.renderComplete_.resolve();
511 }
512
513 // Common signal RENDER_START indicates time to toggle visibility
514 setStyle(this.iframe, 'visibility', '');
515 if (this.win.document && this.win.document.body) {
516 this.win.document.documentElement.classList.add('i-amphtml-fie');
517 setStyles(dev().assertElement(this.win.document.body), {
518 opacity: 1,
519 visibility: 'visible',
520 animation: 'none',
521 });
522 }
523
524 // Initial load signal signal.
525 let rect;
526 if (this.host) {
527 rect = this.host.getLayoutBox();
528 } else {
529 rect = layoutRectLtwh(
530 0,
531 0,
532 this.win./*OK*/ innerWidth,
533 this.win./*OK*/ innerHeight
534 );
535 }
536 Promise.all([
537 this.whenRenderComplete(),
538 whenContentIniLoad(this.ampdoc, this.win, rect),
539 ]).then(() => {
540 this.signals_.signal(CommonSignals_Enum.INI_LOAD);
541 });
542 }
543
544 /**
545 * @return {!HTMLBodyElement}

Callers 1

Calls 13

whenRenderCompleteMethod · 0.95
setStyleFunction · 0.90
setStylesFunction · 0.90
devFunction · 0.90
layoutRectLtwhFunction · 0.90
whenContentIniLoadFunction · 0.90
resolveMethod · 0.80
assertElementMethod · 0.80
renderStartedMethod · 0.45
signalMethod · 0.45
addMethod · 0.45
getLayoutBoxMethod · 0.45

Tested by

no test coverage detected