mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Inline some functions
This commit is contained in:
parent
9ee11654a6
commit
a7756cec13
@ -164,9 +164,7 @@ WeatherProvider.register("envcanada", {
|
|||||||
// CORS errors when accessing EC
|
// CORS errors when accessing EC
|
||||||
//
|
//
|
||||||
getUrl() {
|
getUrl() {
|
||||||
const path = "https://thingproxy.freeboard.io/fetch/https://dd.weather.gc.ca/citypage_weather/xml/" + this.config.provCode + "/" + this.config.siteCode + "_e.xml";
|
return "https://thingproxy.freeboard.io/fetch/https://dd.weather.gc.ca/citypage_weather/xml/" + this.config.provCode + "/" + this.config.siteCode + "_e.xml";
|
||||||
|
|
||||||
return path;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -71,13 +71,11 @@ WeatherProvider.register("ukmetofficedatahub", {
|
|||||||
// For DataHub requests, the API key/secret are sent in the headers rather than as query strings.
|
// For DataHub requests, the API key/secret are sent in the headers rather than as query strings.
|
||||||
// Headers defined according to Data Hub API (https://metoffice.apiconnect.ibmcloud.com/metoffice/production/api)
|
// Headers defined according to Data Hub API (https://metoffice.apiconnect.ibmcloud.com/metoffice/production/api)
|
||||||
getHeaders() {
|
getHeaders() {
|
||||||
let headers = {
|
return {
|
||||||
accept: "application/json",
|
accept: "application/json",
|
||||||
"x-ibm-client-id": this.config.apiKey,
|
"x-ibm-client-id": this.config.apiKey,
|
||||||
"x-ibm-client-secret": this.config.apiSecret
|
"x-ibm-client-secret": this.config.apiSecret
|
||||||
};
|
};
|
||||||
|
|
||||||
return headers;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Fetch data using supplied URL and request headers
|
// Fetch data using supplied URL and request headers
|
||||||
|
@ -90,8 +90,7 @@ class WeatherObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kmhWindSpeed() {
|
kmhWindSpeed() {
|
||||||
const windInKmh = this.windUnits === "imperial" ? this.windSpeed * 1.609344 : (this.windSpeed * 60 * 60) / 1000;
|
return this.windUnits === "imperial" ? this.windSpeed * 1.609344 : (this.windSpeed * 60 * 60) / 1000;
|
||||||
return windInKmh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nextSunAction() {
|
nextSunAction() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user