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

Method createdCallback

src/custom-element.js:144–298  ·  view source on GitHub ↗

* Called when elements is created. Sets instance vars since there is no * constructor. * @final

()

Source from the content-addressed store, hash-verified

142 * @final
143 */
144 createdCallback() {
145 // Flag "notbuilt" is removed by Resource manager when the resource is
146 // considered to be built. See "setBuilt" method.
147 /** @private {boolean} */
148 this.built_ = false;
149
150 /**
151 * Several APIs require the element to be connected to the DOM tree, but
152 * the CustomElement lifecycle APIs are async. This lead to subtle bugs
153 * that require state tracking. See #12849, https://crbug.com/821195, and
154 * https://bugs.webkit.org/show_bug.cgi?id=180940.
155 * @private {boolean}
156 */
157 this.isConnected_ = false;
158
159 /** @private {?Promise} */
160 this.buildingPromise_ = null;
161
162 /**
163 * Indicates that the `mountCallback()` has been called and it hasn't
164 * been reversed with an `unmountCallback()` call.
165 * @private {boolean}
166 */
167 this.mounted_ = false;
168
169 /** @private {?Promise} */
170 this.mountPromise_ = null;
171
172 /** @private {?AbortController} */
173 this.mountAbortController_ = null;
174
175 /** @private {!ReadyState_Enum} */
176 this.readyState_ = ReadyState_Enum.UPGRADING;
177
178 /** @type {boolean} */
179 this.everAttached = false;
180
181 /**
182 * Ampdoc can only be looked up when an element is attached.
183 * @private {?./service/ampdoc-impl.AmpDoc}
184 */
185 this.ampdoc_ = null;
186
187 /**
188 * Resources can only be looked up when an element is attached.
189 * @private {?./service/resources-interface.ResourcesInterface}
190 */
191 this.resources_ = null;
192
193 /** @private {!Layout_Enum} */
194 this.layout_ = Layout_Enum.NODISPLAY;
195
196 /** @private {number} */
197 this.layoutCount_ = 0;
198
199 /** @private {boolean} */
200 this.isFirstLayoutCompleted_ = false;
201

Callers 2

constructorMethod · 0.95
createAmpElementFunction · 0.80

Calls 4

getModeFunction · 0.90
pushMethod · 0.45
signalMethod · 0.45

Tested by

no test coverage detected