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

Method constructor

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

* @param {!Document} doc * @param {!LoadingViewConfig=} config

(doc, config = {})

Source from the content-addressed store, hash-verified

10491 * @param {!LoadingViewConfig=} config
10492 */
10493 constructor(doc, config = {}) {
10494 /** @private @const {!Document} */
10495 this.doc_ = doc;
10496
10497 /** @private @const {!Element} */
10498 this.loadingContainer_ = createElement(
10499 this.doc_,
10500 'swg-loading-container',
10501 {}
10502 );
10503 if (config.additionalClasses) {
10504 for (const additionalClass of config.additionalClasses) {
10505 this.loadingContainer_.classList.add(additionalClass);
10506 }
10507 }
10508
10509 /** @private @const {!Element} */
10510 this.loading_ = createElement(this.doc_, 'swg-loading', {});
10511 this.loadingContainer_.appendChild(this.loading_);
10512
10513 this.loadingContainer_.style.setProperty('display', 'none', 'important');
10514
10515 // Build the animated loading indicator.
10516 this.buildLoadingIndicator_();
10517 }
10518
10519 /**
10520 * Gets the populated loading container.

Callers

nothing calls this directly

Calls 4

setPropertyMethod · 0.80
createElementFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected