Use state as a fallback if current_position == undefined (#117)

* Use state as a fallback if current_position == undefined

* Fix lint errors
This commit is contained in:
Ben Origas 2016-10-05 01:12:40 -05:00 committed by Paulus Schoutsen
parent f4089b6473
commit 71278d7d6b

View File

@ -54,11 +54,17 @@ Polymer({
},
computeIsFullyOpen: function (stateObj) {
return stateObj.attributes.current_position === 100;
if (stateObj.attributes.current_position !== undefined) {
return stateObj.attributes.current_position === 100;
}
return stateObj.state === 'open';
},
computeIsFullyClosed: function (stateObj) {
return stateObj.attributes.current_position === 0;
if (stateObj.attributes.current_position !== undefined) {
return stateObj.attributes.current_position === 0;
}
return stateObj.state === 'closed';
},
onOpenTap: function () {