mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 04:45:17 +00:00
Make all visiable values dynamic.
This commit is contained in:
@@ -5,11 +5,11 @@
|
||||
*
|
||||
* By Michael Teeuw http://michaelteeuw.nl
|
||||
* MIT Licensed.
|
||||
*
|
||||
*
|
||||
* This class is the blueprint for a day which includes weather information.
|
||||
*/
|
||||
|
||||
// Currently this is focused on the information which is nessecery for the current weather.
|
||||
// Currently this is focused on the information which is necessary for the current weather.
|
||||
// As soon as we start implementing the forecast, mode properties will be added.
|
||||
|
||||
class WeatherObject {
|
||||
@@ -60,4 +60,21 @@ class WeatherObject {
|
||||
return "N";
|
||||
}
|
||||
}
|
||||
|
||||
beaufortWindSpeed () {
|
||||
var kmh = this.windSpeed * 60 * 60 / 1000;
|
||||
var speeds = [1, 5, 11, 19, 28, 38, 49, 61, 74, 88, 102, 117, 1000];
|
||||
for (var beaufort in speeds) {
|
||||
var speed = speeds[beaufort];
|
||||
if (speed > kmh) {
|
||||
return beaufort;
|
||||
}
|
||||
}
|
||||
return 12;
|
||||
}
|
||||
|
||||
nextSunAction () {
|
||||
var now = new Date();
|
||||
return (this.sunrise < now && this.sunset > now) ? "sunset" : "sunrise";
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user