* @param {!HTMLIFrameElement} iframe * @param {!FriendlyIframeSpec} spec * @param {!Promise} loadedPromise * @param {?./service/ampdoc-impl.AmpDocFie} ampdoc
(iframe, spec, loadedPromise, ampdoc)
| 360 | * @param {?./service/ampdoc-impl.AmpDocFie} ampdoc |
| 361 | */ |
| 362 | constructor(iframe, spec, loadedPromise, ampdoc) { |
| 363 | /** @const {!HTMLIFrameElement} */ |
| 364 | this.iframe = iframe; |
| 365 | |
| 366 | /** @const {!Window} */ |
| 367 | this.win = /** @type {!Window} */ (iframe.contentWindow); |
| 368 | |
| 369 | /** @const {?./service/ampdoc-impl.AmpDocFie} */ |
| 370 | this.ampdoc = ampdoc; |
| 371 | |
| 372 | /** @const {!FriendlyIframeSpec} */ |
| 373 | this.spec = spec; |
| 374 | |
| 375 | /** @const {?AmpElement} */ |
| 376 | this.host = spec.host || null; |
| 377 | |
| 378 | /** @const @private {time} */ |
| 379 | this.startTime_ = Date.now(); |
| 380 | |
| 381 | /** @private @const */ |
| 382 | this.signals_ = this.ampdoc |
| 383 | ? this.ampdoc.signals() |
| 384 | : this.host |
| 385 | ? this.host.signals() |
| 386 | : new Signals(); |
| 387 | |
| 388 | /** @private @const {!Deferred} */ |
| 389 | this.renderComplete_ = new Deferred(); |
| 390 | |
| 391 | /** @private @const {!Promise} */ |
| 392 | this.winLoadedPromise_ = Promise.all([ |
| 393 | loadedPromise, |
| 394 | this.whenRenderStarted(), |
| 395 | ]); |
| 396 | if (this.ampdoc) { |
| 397 | this.whenRenderComplete().then(() => this.ampdoc.setReady()); |
| 398 | } |
| 399 | |
| 400 | this.win.addEventListener('resize', () => this.handleResize_()); |
| 401 | } |
| 402 | |
| 403 | /** |
| 404 | * Ensures that all resources from this iframe have been released. |
nothing calls this directly
no test coverage detected