MCPcopy Create free account
hub / github.com/ampproject/amphtml / waitForTemplateClass_

Method waitForTemplateClass_

src/service/template-impl.js:287–298  ·  view source on GitHub ↗

* Returns the promise that will eventually yield the template class. This * will wait until the actual template script has been downloaded and parsed. * @param {!Element} element * @param {string} type * @return {!Promise } * @private

(element, type)

Source from the content-addressed store, hash-verified

285 * @private
286 */
287 waitForTemplateClass_(element, type) {
288 if (this.templateClassMap_[type]) {
289 return this.templateClassMap_[type];
290 }
291
292 const deferred = new Deferred();
293 const {promise, resolve} = deferred;
294
295 this.templateClassMap_[type] = promise;
296 this.templateClassResolvers_[type] = resolve;
297 return promise;
298 }
299
300 /**
301 * Registers an extended template. This function should typically be called

Callers 1

getImplementation_Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected