Tidying other modules, fixing password and fx

This commit is contained in:
Martin Donnelly 2017-09-11 16:30:37 +01:00
parent 0a937198a4
commit 19c3711550

View File

@ -29,7 +29,8 @@ const BitcoinModel = Backbone.Model.extend({
const btcupdateFn = function() {
this.update();
};
setTimeout(btcupdateFn.bind(this), mod + 10);
console.log('>> btc timeout disabled');
// setTimeout(btcupdateFn.bind(this), mod + 10);
},
'updateHourly': function () {
this.getBalance();
@ -37,9 +38,10 @@ const BitcoinModel = Backbone.Model.extend({
const mod = 3600000 - (now.getTime() % 3600000);
const btcupdateFn = function() {
this.update();
this.updateHourly();
};
setTimeout(btcupdateFn.bind(this), mod + 10);
console.log('>> balance timeout disabled');
// setTimeout(btcupdateFn.bind(this), mod + 10);
},
'recalc': function () {
let data = this.get('btcdata');
@ -95,6 +97,7 @@ const BitcoinModel = Backbone.Model.extend({
// total = myBTC * g;
},
'getBTC': function () {
console.log('>> getBTC');
const self = this;
const url = this.get('url');
$.ajax({
@ -154,6 +157,27 @@ const BitcoinModel = Backbone.Model.extend({
console.log(type);
}
});
},
'btcFromSocket': function (data) {
let self = this;
console.log('>> btc from the socket', data);
const gbp = data.bpi.GBP.rate_float;
const usd = data.bpi.USD.rate_float;
const trend = data.trend;
const btcdata = self.get('btcdata');
btcdata.gbp = gbp;
btcdata.usd = usd;
btcdata.trend = trend;
self.set('btcdata', btcdata);
self.recalc();
},
'balanceFromSocket': function (data) {
let self = this;
console.log('>> balance from the socket', data);
const balance = data.balance;
self.set('balance', balance);
self.recalc();
}
});
const Bitcoin = Backbone.View.extend({