* Run Hass.io in an iframe * Update hass.io build script * Lint * Lint * Fix build script * Lint
53 lines
1.3 KiB
HTML
53 lines
1.3 KiB
HTML
<link rel="import" href="../bower_components/polymer/polymer-element.html">
|
|
<link rel="import" href="./hassio-main.html">
|
|
|
|
<dom-module id="hassio-app">
|
|
<template>
|
|
<template is='dom-if' if='[[hass]]'>
|
|
<hassio-main
|
|
hass='[[hass]]'
|
|
narrow='[[narrow]]'
|
|
show-menu='[[showMenu]]'
|
|
route='[[route]]'
|
|
></hassio-main>
|
|
</template>
|
|
</template>
|
|
</dom-module>
|
|
|
|
<script>
|
|
class HassioApp extends Polymer.Element {
|
|
static get is() { return 'hassio-app'; }
|
|
|
|
static get properties() {
|
|
return {
|
|
hass: Object,
|
|
narrow: Boolean,
|
|
showMenu: Boolean,
|
|
route: Object,
|
|
hassioPanel: {
|
|
type: Object,
|
|
value: window.parent.hassioPanel,
|
|
},
|
|
};
|
|
}
|
|
|
|
ready() {
|
|
super.ready();
|
|
window.setProperties = this.setProperties.bind(this);
|
|
this.addEventListener('location-changed', () => this._locationChanged());
|
|
this.addEventListener('hass-open-menu', () => this._menuEvent(true));
|
|
this.addEventListener('hass-close-menu', () => this._menuEvent(false));
|
|
}
|
|
|
|
_menuEvent(shouldOpen) {
|
|
this.hassioPanel.fire(shouldOpen ? 'hass-open-menu' : 'hass-close-menu');
|
|
}
|
|
|
|
_locationChanged() {
|
|
this.hassioPanel.navigate(window.location.pathname);
|
|
}
|
|
}
|
|
|
|
customElements.define(HassioApp.is, HassioApp);
|
|
</script>
|