From 03c275d7e8641dee53311ed7c4c12e861517d686 Mon Sep 17 00:00:00 2001 From: Nikolay Vasilchuk Date: Wed, 16 Oct 2019 16:09:34 +0300 Subject: [PATCH] Release --- dist/starline-card.js | 27 +++++++++++++++++++++++---- package.json | 2 +- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/dist/starline-card.js b/dist/starline-card.js index 7afe7a9..e1ccc28 100644 --- a/dist/starline-card.js +++ b/dist/starline-card.js @@ -653,20 +653,39 @@ class StarlineCard extends HTMLElement { } else { _startTimeout(); } + + this._fireEvent('haptic', 'light'); } _startBtnProgress($element, timeout) { $element.classList.add('__inprogress'); clearTimeout(this._inProgressTimeout); - this._inProgressTimeout = setTimeout(() => $element.classList.remove('__inprogress'), timeout); + this._inProgressTimeout = setTimeout(() => this._stopBtnProgress(), timeout); } _stopBtnProgress() { + const CLS = '__inprogress'; + let hadClass = false; + clearTimeout(this._inProgressTimeout); this._inProgressTimeout = null; - this.$controlLeft.classList.remove('__inprogress'); - this.$controlCenter.classList.remove('__inprogress'); - this.$controlRight.classList.remove('__inprogress'); + + if (this.$controlLeft.classList.contains(CLS)) { + this.$controlLeft.classList.remove(CLS); + hadClass = true; + } + if (this.$controlCenter.classList.contains(CLS)) { + this.$controlCenter.classList.remove(CLS); + hadClass = true; + } + if (this.$controlRight.classList.contains(CLS)) { + this.$controlRight.classList.remove(CLS); + hadClass = true; + } + + if (hadClass) { + this._fireEvent('haptic', 'warning'); + } } _setSize() { diff --git a/package.json b/package.json index ea0f3a1..3f6b0fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lovelace-starline-card", - "version": "1.0.11", + "version": "1.0.12", "description": "Custom Lovelace Card for StarLine integration", "scripts": { "build": "node scripts/build.js"