Add a small forecast example.

This commit is contained in:
Michael Teeuw
2017-09-22 13:26:44 +02:00
parent 713111254b
commit ff9c6bac0a
4 changed files with 101 additions and 14 deletions

View File

@@ -57,8 +57,8 @@ var WeatherProvider = Class.extend({
// This method should start the API request to fetch the weather forecast.
// This method should definetly be overwritten in the provider.
fetchWeatherForeCast: function() {
Log.warn("Weather provider: " + this.providerName + " does not subclass the fetchWeatherForeCast method.")
fetchWeatherForecast: function() {
Log.warn("Weather provider: " + this.providerName + " does not subclass the fetchWeatherForecast method.")
},
// This returns a WeatherDay object for the current weather.
@@ -71,7 +71,7 @@ var WeatherProvider = Class.extend({
return this.weatherForecastArray
},
// Set the currentWeather and notify the delegate that new information is availabe.
// Set the currentWeather and notify the delegate that new information is available.
setCurrentWeather: function(currentWeatherObject) {
// We should check here if we are passing a WeatherDay
this.currentWeatherObject = currentWeatherObject
@@ -79,6 +79,14 @@ var WeatherProvider = Class.extend({
this.updateAvailable()
},
// Set the weatherForecastArray and notify the delegate that new information is available.
setWeatherForecast: function(weatherForecastArray) {
// We should check here if we are passing a WeatherDay
this.weatherForecastArray = weatherForecastArray
this.updateAvailable()
},
// Notify the delegate that new weather is available.
updateAvailable: function() {
this.delegate.updateAvailable(this)