-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.js
26 lines (26 loc) Β· 1.17 KB
/
ui.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
class UI {
constructor() {
this.location = document.getElementById('w-location');
this.desc = document.getElementById('w-desc');
this.string = document.getElementById('w-string');
this.details = document.getElementById('w-details');
this.icon = document.getElementById('w-icon');
this.humidity = document.getElementById('w-humidity');
// this.feelsLike = document.getElementById('w-feels-like');
this.dewpoint = document.getElementById('w-dewpoint');
this.wind = document.getElementById('w-wind');
}
paint(weather) {
this.location.textContent = weather.name;
this.desc.textContent = weather.weather[0].description;
this.string.textContent = weather.main.temp + 'Β°C';
this.icon.setAttribute(
'src',
`http://openweathermap.org/img/wn/${weather.weather[0].icon}@2x.png`
);
this.humidity.textContent = `Relative Humidity: ${weather.main.humidity}`;
// this.feelsLike.textContent = `Visibility: ${weather.visibility}m`
this.dewpoint.textContent = `Wind Direction: ${weather.wind.deg} degrees`;
this.wind.textContent = `Wind Speed: ${weather.wind.speed}m/s`;
}
}