using the host from the document.location
This commit is contained in:
parent
80179091b6
commit
59675e69ca
@ -19,7 +19,8 @@
|
||||
</div>
|
||||
<div class="section">Indoors</div>
|
||||
<div>
|
||||
<div class="temp" id="indoorTemp"></div>
|
||||
|
||||
<span class="temp" id="indoorTemp"></span> <span id='fan' class="fan">Fan On</span>
|
||||
</div>
|
||||
|
||||
<div class="section">Weather</div>
|
||||
|
@ -6,18 +6,29 @@ let TempModel = Backbone.Model.extend({});
|
||||
|
||||
let Temp = Backbone.View.extend({
|
||||
tagName: 'div',
|
||||
initialize: function () {
|
||||
initialize: function() {
|
||||
_.bindAll(this, 'render');
|
||||
this.model.bind('change', this.render);
|
||||
|
||||
this.$indoorTemp = $('#indoorTemp');
|
||||
this.$fan = $('#fan');
|
||||
|
||||
this.$fan.hide();
|
||||
|
||||
},
|
||||
render: function () {
|
||||
render: function() {
|
||||
console.log('Temp:Render');
|
||||
const data = this.model.get('data');
|
||||
|
||||
this.$indoorTemp.empty().html(parseFloat(data.temp) + '°c ');
|
||||
|
||||
if (data.mode === 'FanOff' && this.$fan.is(':visible')) {
|
||||
this.$fan.hide();
|
||||
}
|
||||
|
||||
if (data.mode === 'FanOn' && this.$fan.is(':hidden')) {
|
||||
this.$fan.show();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user