-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.js
24 lines (23 loc) · 1.08 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
class UI {
constructor() {
this.location = document.getElementById('w-location');
this.description = document.getElementById('w-desc');
this.string = document.getElementById('w-string');
this.icon = document.getElementById('w-icon');
this.humidity = document.getElementById('w-humidity');
this.tempMax = document.getElementById('w-dewpoint');
this.pressure = document.getElementById('w-feels-like');
this.wind = document.getElementById('w-wind');
}
// Paint Weather in UI
paint(weather) {
this.location.textContent = weather.name;
this.description.textContent = weather.weather[0].main;
this.string.textContent = weather.main.temp + "℃";
this.icon.setAttribute('src', `http://openweathermap.org/img/w/${weather.weather[0].icon}.png`);
this.humidity.textContent = `Relative Humidity: ${weather.main.humidity}%`;
this.tempMax.textContent = `Maximum Temperature: ${weather.main.temp_max}℃`;
this.pressure.textContent = `Pressure Level: ${weather.main.pressure}`;
this.wind.textContent = `Wind Speed: ${weather.wind.speed} m/s`;
}
}