From fac69b57fa31c99089f24d58f142ce090b33ef8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Fri, 25 Jan 2019 13:28:43 +0100 Subject: [PATCH] Update for Home Assistant 0.86 --- layout-card.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/layout-card.js b/layout-card.js index ba8d37f..d27bf27 100644 --- a/layout-card.js +++ b/layout-card.js @@ -1,3 +1,4 @@ +customElements.whenDefined('card-tools').then(() => { class LayoutCard extends Polymer.Element { static get template() { @@ -27,8 +28,7 @@ class LayoutCard extends Polymer.Element { } setConfig(config) { - if(!window.cardTools) throw new Error(`Can't find card-tools. See https://github.com/thomasloven/lovelace-card-tools`); - window.cardTools.checkVersion(0.1); + cardTools.checkVersion(0.1); this.config = config; @@ -161,3 +161,11 @@ class LayoutCard extends Polymer.Element { } customElements.define('layout-card', LayoutCard); +}); + +window.setTimeout(() => { + if(customElements.get('card-tools')) return; + customElements.define('layout-card', class extends HTMLElement{ + setConfig() { throw new Error("Can't find card-tools. See https://github.com/thomasloven/lovelace-card-tools");} + }); +}, 2000);