mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-27 00:16:44 +00:00
Merge conflict.
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
{% endif %}
|
||||
<span class="wi dimmed wi-{{ current.nextSunAction() }}"></span>
|
||||
<span>
|
||||
{% if current.nextSunAction() == "sunset" %}
|
||||
{% if current.nextSunAction() === "sunset" %}
|
||||
{{ current.sunset | formatTime }}
|
||||
{% else %}
|
||||
{{ current.sunrise | formatTime }}
|
||||
|
@@ -86,9 +86,9 @@ WeatherProvider.register("openweathermap", {
|
||||
*/
|
||||
generateWeatherObjectsFromForecast(forecasts) {
|
||||
|
||||
if (this.config.weatherEndpoint == "/forecast") {
|
||||
if (this.config.weatherEndpoint === "/forecast") {
|
||||
return this.fetchForecastHourly(forecasts);
|
||||
} else if (this.config.weatherEndpoint == "/forecast/daily") {
|
||||
} else if (this.config.weatherEndpoint === "/forecast/daily") {
|
||||
return this.fetchForecastDaily(forecasts);
|
||||
}
|
||||
// if weatherEndpoint does not match forecast or forecast/daily, what should be returned?
|
||||
|
@@ -143,7 +143,7 @@ Module.register("weather",{
|
||||
humidity: this.indoorHumidity,
|
||||
temperature: this.indoorTemperature
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
// What to do when the weather provider has new information available?
|
||||
@@ -217,7 +217,7 @@ Module.register("weather",{
|
||||
}
|
||||
}
|
||||
} else if (type === "humidity") {
|
||||
value += "%"
|
||||
value += "%";
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@@ -9,7 +9,6 @@
|
||||
* This class is the blueprint for a weather provider.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Base BluePrint for the WeatherProvider
|
||||
*/
|
||||
@@ -23,15 +22,14 @@ var WeatherProvider = Class.extend({
|
||||
weatherForecastArray: null,
|
||||
fetchedLocationName: null,
|
||||
|
||||
// The following properties will be set automaticly.
|
||||
// The following properties will be set automatically.
|
||||
// You do not need to overwrite these properties.
|
||||
config: null,
|
||||
delegate: null,
|
||||
providerIdentifier: null,
|
||||
|
||||
|
||||
// Weather Provider Methods
|
||||
// All the following methods can be overwrited, although most are good as they are.
|
||||
// All the following methods can be overwritten, although most are good as they are.
|
||||
|
||||
// Called when a weather provider is initialized.
|
||||
init: function(config) {
|
||||
@@ -51,13 +49,13 @@ var WeatherProvider = Class.extend({
|
||||
},
|
||||
|
||||
// This method should start the API request to fetch the current weather.
|
||||
// This method should definetly be overwritten in the provider.
|
||||
// This method should definitely be overwritten in the provider.
|
||||
fetchCurrentWeather: function() {
|
||||
Log.warn(`Weather provider: ${this.providerName} does not subclass the fetchCurrentWeather method.`);
|
||||
},
|
||||
|
||||
// This method should start the API request to fetch the weather forecast.
|
||||
// This method should definetly be overwritten in the provider.
|
||||
// This method should definitely be overwritten in the provider.
|
||||
fetchWeatherForecast: function() {
|
||||
Log.warn(`Weather provider: ${this.providerName} does not subclass the fetchWeatherForecast method.`);
|
||||
},
|
||||
@@ -103,7 +101,7 @@ var WeatherProvider = Class.extend({
|
||||
this.delegate.updateAvailable(this);
|
||||
},
|
||||
|
||||
// A convinience function to make requests. It returns a promise.
|
||||
// A convenience function to make requests. It returns a promise.
|
||||
fetchData: function(url, method = "GET", data = null) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var request = new XMLHttpRequest();
|
||||
@@ -113,12 +111,12 @@ var WeatherProvider = Class.extend({
|
||||
if (this.status === 200) {
|
||||
resolve(JSON.parse(this.response));
|
||||
} else {
|
||||
reject(request)
|
||||
reject(request);
|
||||
}
|
||||
}
|
||||
};
|
||||
request.send();
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user