-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathWB-dataObjects.js
106 lines (100 loc) · 2.06 KB
/
WB-dataObjects.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/* Magic Mirror - WallberryTheme <3
* Module: WB-weather
*
* By JSC (@delightedCrow)
* MIT Licensed.
*/
/**
* A class representing current weather data.
* @class
*/
class WBWeather {
constructor() {
// TODO: Expand WBWeather's properties with some of the more common weather data info available
/**
* An array of WBForecast objects
* @type {Array}
*/
this.forecast = null;
/**
* The current temperature
* @type {Number}
*/
this.temp = null;
/**
* The name of the weather icon to be used for this weather
* See https://erikflowers.github.io/weather-icons/
* @type {String}
*/
this.wicon = null;
/**
* The long-form description of the current weather.
* @type {String}
*/
this.longDescription = null;
}
}
/**
* A class representing forecasted weather data.
* @class
*/
class WBForecast {
constructor() {
// TODO: Expand WBForecast's properties with some of the more common weather data info available
/**
* The of time the forecasted data (Unix, UTC)
* @type {Number}
*/
this.date = null;
/**
* The name of the weather icon to be used for this weather
* See https://erikflowers.github.io/weather-icons/
* @type {String}
*/
this.wicon = null;
/**
* The percentage chance of precipitation (0 to 100)
* @type {Number}
*/
this.precipChance = null;
/**
* Type of precipitation expected - either "snow" or "rain"
* @type {String}
*/
this.precipType = null;
/**
* The forecasted low temperature
* @type {Number}
*/
this.minTemp = null;
/**
* The forecasted high temperature
* @type {Number}
*/
this.maxTemp = null;
}
}
/**
* A class representing an error.
* @class
*/
class WBError {
constructor(isTemporary, description, delay) {
/**
* If the error is temporary (true) or not (false)
* @type {Boolean}
*/
this.isTemporary = isTemporary;
/**
* The error message text
* @type {String}
*/
this.description = description;
/**
* The time delay before next fetch, in milliseconds
* (only used for temporary errors)
* @type {Number}
*/
this.retryDelay = delay;
}
}