diff --git a/app/js/modules/train.js b/app/js/modules/train.js index 14cd5d5..2651769 100644 --- a/app/js/modules/train.js +++ b/app/js/modules/train.js @@ -21,11 +21,18 @@ let TrainModel = Backbone.Model.extend({ this.update(); }, update: function () { - this.getTrain(); + const now = new Date; const mod = 60000 - (now.getTime() % 60000); + const hours = now.getHours(); + + if (hours >= 6) { + this.getTrain(); + } + let trainUpdateFn = function () { + this.update(); }; setTimeout(trainUpdateFn.bind(this), mod + 10);