custom panel example: update to polymer 2 class (#3693)
This commit is contained in:
parent
f2ec8c291f
commit
39c2487cf0
1 changed files with 30 additions and 30 deletions
|
@ -28,38 +28,38 @@ The `hello.html` contains the needed building blocks to create the elements insi
|
||||||
</dom-module>
|
</dom-module>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
Polymer({
|
class HaPanelHello extends Polymer.Element {
|
||||||
is: 'ha-panel-hello',
|
static get is() { return 'ha-panel-hello'; }
|
||||||
properties: {
|
|
||||||
// Home Assistant object
|
static get properties() {
|
||||||
hass: {
|
return {
|
||||||
type: Object,
|
// Home Assistant object
|
||||||
},
|
hass: Object,
|
||||||
// If should render in narrow mode
|
// If should render in narrow mode
|
||||||
narrow: {
|
narrow: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: false,
|
value: false,
|
||||||
},
|
},
|
||||||
// If sidebar is currently shown
|
// If sidebar is currently shown
|
||||||
showMenu: {
|
showMenu: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: false,
|
value: false,
|
||||||
},
|
},
|
||||||
// Home Assistant panel info
|
// Home Assistant panel info
|
||||||
// panel.config contains config passed to register_panel serverside
|
// panel.config contains config passed to register_panel serverside
|
||||||
panel: {
|
panel: Object,
|
||||||
type: Object,
|
who: {
|
||||||
},
|
type: String,
|
||||||
who: {
|
computed: 'computeWho(panel)',
|
||||||
type: String,
|
},
|
||||||
computed: 'computeWho(panel)',
|
};
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
computeWho: function (panel) {
|
computeWho(panel) {
|
||||||
return panel && panel.config && panel.config.who ? panel.config.who : 'World';
|
return panel && panel.config && panel.config.who ? panel.config.who : 'World';
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
customElements.define(HaPanelHello.is, HaPanelHello);
|
||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue