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

Method constructor

third_party/subscriptions-project/swg.js:10803–10880  ·  view source on GitHub ↗

* Create a dialog for the provided doc. * @param {!../model/doc.Doc} doc * @param {!Object =} importantStyles * @param {!Object =} styles * @param {!DialogConfig=} dialogConfig Configuration options for the dialog.

(doc, importantStyles = {}, styles = {}, dialogConfig = {})

Source from the content-addressed store, hash-verified

10801 * @param {!DialogConfig=} dialogConfig Configuration options for the dialog.
10802 */
10803 constructor(doc, importantStyles = {}, styles = {}, dialogConfig = {}) {
10804 /** @private @const {!../model/doc.Doc} */
10805 this.doc_ = doc;
10806
10807 const desktopDialogConfig = dialogConfig.desktopConfig || {};
10808 const supportsWideScreen = !!desktopDialogConfig.supportsWideScreen;
10809
10810 const defaultIframeCssClass = `swg-dialog ${
10811 supportsWideScreen ? 'swg-wide-dialog' : ''
10812 }`;
10813 const iframeCssClass =
10814 dialogConfig.iframeCssClassOverride || defaultIframeCssClass;
10815
10816 /** @private @const {!FriendlyIframe} */
10817 this.iframe_ = new FriendlyIframe(doc.getWin().document, {
10818 'class': iframeCssClass,
10819 });
10820
10821 /** @private @const {!Graypane} */
10822 this.graypane_ = new Graypane$1(doc, Z_INDEX - 1);
10823
10824 const modifiedImportantStyles = Object.assign(
10825 {},
10826 rootElementImportantStyles,
10827 importantStyles
10828 );
10829 setImportantStyles$1(this.iframe_.getElement(), modifiedImportantStyles);
10830
10831 setStyles(this.iframe_.getElement(), styles);
10832
10833 /** @private {LoadingView} */
10834 this.loadingView_ = null;
10835
10836 /** @private {?Element} */
10837 this.container_ = null; // Depends on constructed document inside iframe.
10838
10839 /** @private {?./view.View} */
10840 this.view_ = null;
10841
10842 /** @private {?Promise} */
10843 this.animating_ = null;
10844
10845 /**
10846 * Helps identify stale animations.
10847 * @private {number}
10848 */
10849 this.animationNumber_ = 0;
10850
10851 /** @private {boolean} */
10852 this.hidden_ = false;
10853
10854 /** @private {?./view.View} */
10855 this.previousProgressView_ = null;
10856
10857 /** @const @private {number} */
10858 this.maxAllowedHeightRatio_ =
10859 dialogConfig.maxAllowedHeightRatio !== undefined
10860 ? dialogConfig.maxAllowedHeightRatio

Callers

nothing calls this directly

Calls 6

setImportantStyles$1Function · 0.85
assignMethod · 0.80
matchMediaMethod · 0.80
setStylesFunction · 0.70
getWinMethod · 0.45
getElementMethod · 0.45

Tested by

no test coverage detected