Track when cards get defined (#1310)

This commit is contained in:
Paulus Schoutsen 2018-06-21 10:42:52 -04:00 committed by GitHub
parent 691b80c08a
commit b6ee5442f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -110,6 +110,7 @@ class HUIView extends PolymerElement {
constructor() {
super();
this._elements = [];
this._whenDefined = {};
}
_getElements(cards) {
@ -127,6 +128,10 @@ class HUIView extends PolymerElement {
error = `Unknown card type encountered: "${cardConfig.type}".`;
} else if (!customElements.get(tag)) {
error = `Custom element doesn't exist: "${tag}".`;
if (!(tag in this._whenDefined)) {
this._whenDefined[tag] = customElements.whenDefined(tag)
.then(() => this._configChanged());
}
}
}
if (error) {