Fix more event mixin missing (#570)

This commit is contained in:
Paulus Schoutsen 2017-11-05 12:37:57 -08:00 committed by GitHub
parent 798a2bbd34
commit fe439723ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 9 deletions

View File

@ -1,6 +1,8 @@
<link rel="import" href="../../../bower_components/polymer/polymer-element.html"> <link rel="import" href="../../../bower_components/polymer/polymer-element.html">
<link rel="import" href="./ha-progress-button.html"> <link rel="import" href="./ha-progress-button.html">
<link rel='import' href='../util/hass-mixins.html'>
<dom-module id='ha-call-service-button'> <dom-module id='ha-call-service-button'>
<template> <template>
<ha-progress-button <ha-progress-button
@ -12,7 +14,7 @@
</dom-module> </dom-module>
<script> <script>
class HaCallServiceButton extends Polymer.Element { class HaCallServiceButton extends window.hassMixins.EventsMixin(Polymer.Element) {
static get is() { return 'ha-call-service-button'; } static get is() { return 'ha-call-service-button'; }
static get properties() { static get properties() {

View File

@ -2,6 +2,7 @@
<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout-classes.html"> <link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html"> <link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel='import' href='../util/hass-mixins.html'>
<dom-module id="ha-climate-control"> <dom-module id="ha-climate-control">
<template> <template>
@ -42,7 +43,7 @@
</template> </template>
</dom-module> </dom-module>
<script> <script>
class HaClimateControl extends Polymer.Element { class HaClimateControl extends window.hassMixins.EventsMixin(Polymer.Element) {
static get is() { return 'ha-climate-control'; } static get is() { return 'ha-climate-control'; }
static get properties() { static get properties() {
@ -85,7 +86,7 @@ class HaClimateControl extends Polymer.Element {
} }
} }
valueChanged() { valueChanged() {
// when the value is changed, trigger a potential even fire in // when the value is changed, trigger a potential event fire in
// the future, as long as last changed is far enough in the // the future, as long as last changed is far enough in the
// past. // past.
// //
@ -94,13 +95,13 @@ class HaClimateControl extends Polymer.Element {
// (like set to red), then animate back to black when the // (like set to red), then animate back to black when the
// change event is fired, and the signal sent to home-assistant. // change event is fired, and the signal sent to home-assistant.
if (this.last_changed) { if (this.last_changed) {
window.setTimeout(function (val) { window.setTimeout(() => {
var now = Date.now(); var now = Date.now();
if (now - val.last_changed >= 2000) { if (now - this.last_changed >= 2000) {
val.fire('change'); this.fire('change');
val.last_changed = null; this.last_changed = null;
} }
}, 2010, this); }, 2010);
} }
} }
} }

View File

@ -1,6 +1,8 @@
<link rel="import" href="../../bower_components/polymer/polymer-element.html"> <link rel="import" href="../../bower_components/polymer/polymer-element.html">
<link rel="import" href="../../bower_components/paper-toggle-button/paper-toggle-button.html"> <link rel="import" href="../../bower_components/paper-toggle-button/paper-toggle-button.html">
<link rel='import' href='../util/hass-mixins.html'>
<dom-module id='ha-push-notifications-toggle'> <dom-module id='ha-push-notifications-toggle'>
<template> <template>
<paper-toggle-button <paper-toggle-button
@ -13,7 +15,7 @@
</dom-module> </dom-module>
<script> <script>
class HaPushNotificationsToggle extends Polymer.Element { class HaPushNotificationsToggle extends window.hassMixins.EventsMixin(Polymer.Element) {
static get is() { return 'ha-push-notifications-toggle'; } static get is() { return 'ha-push-notifications-toggle'; }
static get properties() { static get properties() {