MCPcopy Index your code
hub / github.com/ampproject/amphtml / constructor

Method constructor

src/preact/base-element.js:261–339  ·  view source on GitHub ↗

@param {AmpElement} element

(element)

Source from the content-addressed store, hash-verified

259
260 /** @param {AmpElement} element */
261 constructor(element) {
262 super(element);
263
264 /** @protected {JsonObject} */
265 this.defaultProps_ = this.getDefaultProps();
266
267 /**
268 * @type {import('./context').AmpContext}
269 * @private
270 */
271 this.context_ = {
272 renderable: false,
273 playable: true,
274 loading: Loading_Enum.AUTO,
275 notify: () => this.mutateElement(() => {}),
276 };
277
278 /** @private {boolean} */
279 this.resetLoading_ = false;
280
281 /** @private {API_TYPE|null} */
282 this.apiWrapper_ = null;
283
284 /**
285 * @type {API_TYPE|null}
286 * @private
287 */
288 this.currentRef_ = null;
289
290 /** @type {function(API_TYPE):void} current */
291 this.refSetter_ = (current) => {
292 // The API shape **must** be consistent.
293 if (current !== null) {
294 if (this.apiWrapper_) {
295 this.checkApiWrapper_(current);
296 } else {
297 this.initApiWrapper_(current);
298 }
299 }
300 this.currentRef_ = current;
301 this.maybeUpdateReadyState_();
302 };
303
304 /** @type {?Deferred<API_TYPE>} */
305 this.deferredApi_ = null;
306
307 /** @private {?Array} */
308 this.contextValues_ = null;
309
310 /** @protected {Element | null} */
311 this.container_ = null;
312
313 /** @private {boolean} */
314 this.scheduledRender_ = false;
315
316 /** @private {?Deferred} */
317 this.renderDeferred_ = null;
318

Callers

nothing calls this directly

Calls 4

getDefaultPropsMethod · 0.95
rerender_Method · 0.95
mutateElementMethod · 0.45

Tested by

no test coverage detected