Fix miniy fail (#1674)

This commit is contained in:
Paulus Schoutsen 2018-09-19 11:32:24 +02:00 committed by GitHub
parent 7e0ff14f28
commit 15d21cc673
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

View File

@ -7,9 +7,10 @@ class HuiErrorCard extends PolymerElement {
<style>
:host {
display: block;
background-color: red;
background-color: #ef5350;
color: white;
padding: 8px;
font-weight: 500;
}
</style>
[[_config.error]]

View File

@ -61,11 +61,6 @@ function _createErrorElement(error, config) {
return _createElement('hui-error-card', createErrorCardConfig(error, config));
}
function _hideErrorElement(element) {
element.style.display = 'None';
return window.setTimeout(() => { element.style.display = ''; }, TIMEOUT);
}
export default function createCardElement(config) {
if (!config || typeof config !== 'object' || !config.type) {
return _createErrorElement('No card type configured.', config);
@ -78,7 +73,8 @@ export default function createCardElement(config) {
return _createElement(tag, config);
}
const element = _createErrorElement(`Custom element doesn't exist: ${tag}.`, config);
const timer = _hideErrorElement(element);
element.style.display = 'None';
const timer = window.setTimeout(() => { element.style.display = ''; }, TIMEOUT);
customElements.whenDefined(tag).then(() => {
clearTimeout(timer);