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

Method constructor

src/service/resources-impl.js:45–226  ·  view source on GitHub ↗

* @param {!./ampdoc-impl.AmpDoc} ampdoc

(ampdoc)

Source from the content-addressed store, hash-verified

43 * @param {!./ampdoc-impl.AmpDoc} ampdoc
44 */
45 constructor(ampdoc) {
46 /** @const {!./ampdoc-impl.AmpDoc} */
47 this.ampdoc = ampdoc;
48
49 /** @const {!Window} */
50 this.win = ampdoc.win;
51
52 /** @const @private {!./viewer-interface.ViewerInterface} */
53 this.viewer_ = Services.viewerForDoc(ampdoc);
54
55 /** @private {boolean} */
56 this.isRuntimeOn_ = this.viewer_.isRuntimeOn();
57
58 /**
59 * Used primarily for testing to allow build phase to proceed.
60 * @const @private {boolean}
61 */
62 this.isBuildOn_ = false;
63
64 /** @private {number} */
65 this.resourceIdCounter_ = 0;
66
67 /** @private @const {!Array<!Resource>} */
68 this.resources_ = [];
69
70 /** @private {number} */
71 this.addCount_ = 0;
72
73 /** @private {number} */
74 this.buildAttemptsCount_ = 0;
75
76 /** @private {number} */
77 this.buildsThisPass_ = 0;
78
79 /** @private {boolean} */
80 this.visible_ = this.ampdoc.isVisible();
81
82 /** @private {boolean} */
83 this.documentReady_ = false;
84
85 /**
86 * We want to do some work in the first pass after
87 * the document is ready.
88 * @private {boolean}
89 */
90 this.firstPassAfterDocumentReady_ = true;
91
92 /**
93 * Whether AMP has been fully initialized.
94 * @private {boolean}
95 */
96 this.ampInitialized_ = false;
97
98 /**
99 * We also adjust the timeout penalty shortly after the first pass.
100 * @private {number}
101 */
102 this.firstVisibleTime_ = -1;

Callers

nothing calls this directly

Calls 15

doPassMethod · 0.95
schedulePassMethod · 0.95
rebuildDomWhenReady_Method · 0.95
scrolled_Method · 0.95
devFunction · 0.90
startupChunkFunction · 0.90
throttleFunction · 0.90
listenFunction · 0.90
nowMethod · 0.80
fineMethod · 0.80
isRuntimeOnMethod · 0.45

Tested by

no test coverage detected