Add decorators (#2711)

* Add decorators

* Lint
This commit is contained in:
Paulus Schoutsen
2019-02-09 10:47:39 -08:00
committed by GitHub
parent 46e1139946
commit 039bc587cc
12 changed files with 92 additions and 133 deletions

View File

@@ -9,7 +9,7 @@ import {
html,
CSSResult,
css,
PropertyDeclarations,
property,
} from "lit-element";
import { HomeAssistant } from "../../types";
import { HassEntity } from "home-assistant-js-websocket";
@@ -17,7 +17,7 @@ import { HassEntity } from "home-assistant-js-websocket";
class HaEntityToggle extends LitElement {
// hass is not a property so that we only re-render on stateObj changes
public hass?: HomeAssistant;
public stateObj?: HassEntity;
@property() public stateObj?: HassEntity;
protected render(): TemplateResult | void {
if (!this.stateObj) {
@@ -51,12 +51,6 @@ class HaEntityToggle extends LitElement {
`;
}
static get properties(): PropertyDeclarations {
return {
stateObj: {},
};
}
protected firstUpdated(changedProps) {
super.firstUpdated(changedProps);
this.addEventListener("click", (ev) => ev.stopPropagation());