Remove ES6 from web components

This commit is contained in:
Paulus Schoutsen 2016-06-11 23:55:43 -07:00
parent 19eb3fa193
commit 943e9b2899
6 changed files with 11 additions and 9 deletions

View File

@ -130,7 +130,7 @@ Polymer({
}, },
imageChanged: function (newVal) { imageChanged: function (newVal) {
this.$.badge.style.backgroundImage = newVal ? `url(${newVal})` : ''; this.$.badge.style.backgroundImage = newVal ? 'url(' + newVal + ')' : '';
}, },
}); });
</script> </script>

View File

@ -68,15 +68,17 @@ Polymer({
}, },
}, },
viewTapped() { viewTapped: function () {
this.fire('view-tapped'); this.fire('view-tapped');
}, },
viewSelected(ev) { viewSelected: function (ev) {
var view = ev.detail.item.getAttribute('data-entity') || null; var view = ev.detail.item.getAttribute('data-entity') || null;
var current = this.currentView || null; var current = this.currentView || null;
if (view !== current) { if (view !== current) {
this.async(function () { this.hass.viewActions.selectView(view); }.bind(this), 0); this.async(function () {
this.hass.viewActions.selectView(view);
}.bind(this), 0);
} }
}, },
}); });

View File

@ -81,7 +81,7 @@ Polymer({
this.iconsLoaded = true; this.iconsLoaded = true;
}.bind(this); }.bind(this);
this.importHref(`/static/mdi-${this.icons}.html`, this.importHref('/static/mdi-' + this.icons + '.html',
success, success,
function () { function () {
this.importHref('/static/mdi.html', success, success); this.importHref('/static/mdi.html', success, success);

View File

@ -39,8 +39,8 @@ Polymer({
if (hass.demo) { if (hass.demo) {
return '/demo/webcam.jpg'; return '/demo/webcam.jpg';
} else if (stateObj) { } else if (stateObj) {
return `/api/camera_proxy_stream/${stateObj.entityId}` + return '/api/camera_proxy_stream/' + stateObj.entityId +
`?token=${stateObj.attributes.access_token}`; '?token=' + stateObj.attributes.access_token;
} }
// Return an empty image if no stateObj (= dialog not open) // Return an empty image if no stateObj (= dialog not open)
return 'data:image/gif;base64,R0lGODlhAQABAAAAACw='; return 'data:image/gif;base64,R0lGODlhAQABAAAAACw=';

View File

@ -69,7 +69,7 @@ Polymer({
return; return;
} }
this.hass.serviceActions.callService('input_select', 'select_option', { this.hass.serviceActions.callService('input_select', 'select_option', {
option, option: option,
entity_id: this.stateObj.entityId, entity_id: this.stateObj.entityId,
}); });
}, },

View File

@ -16,7 +16,7 @@ window.hassBehavior = {
var getter = this.properties[key].bindNuclear(hass); var getter = this.properties[key].bindNuclear(hass);
if (!getter) { if (!getter) {
throw new Error(`Undefined getter specified for key ${key}`); throw new Error('Undefined getter specified for key ' + key);
} }
this[key] = hass.reactor.evaluate(getter); this[key] = hass.reactor.evaluate(getter);