* 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)
| 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 |