From 0dee9c0bd914429c553406a3f5d3e74767175a4e Mon Sep 17 00:00:00 2001 From: Jon Heller Date: Sun, 18 Oct 2015 22:13:59 -0400 Subject: [PATCH] set weather updates on an interval --- js/weather/weather.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/js/weather/weather.js b/js/weather/weather.js index 1a20382b..f7b3c3de 100644 --- a/js/weather/weather.js +++ b/js/weather/weather.js @@ -135,16 +135,17 @@ weather.updateWeatherForecast = function () { weather.init = function () { - if (weather.params.lang === undefined) { - weather.params.lang = weather.lang; + if (this.params.lang === undefined) { + this.params.lang = this.lang; } - if (weather.params.cnt === undefined) { - weather.params.cnt = 5; + if (this.params.cnt === undefined) { + this.params.cnt = 5; } - weather.updateCurrentWeather(); - - weather.updateWeatherForecast(); + this.intervalId = setInterval(function () { + this.updateCurrentWeather(); + this.updateWeatherForecast(); + }.bind(this), this.updateInterval); } \ No newline at end of file