-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
23 lines (21 loc) · 924 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const amountElement = document.querySelector("#amount")
const firstSelect = document.querySelector("#firstCurrency")
const secondSelect = document.querySelector("#secondCurrency")
const firstOutput = document.querySelector("#firstOutput")
const secondOutput = document.querySelector("#secondOutput")
const rate = document.querySelector("#rate")
const date = document.querySelector("#date")
const result = document.querySelector("#result")
function eventListeners() {
amountElement.addEventListener("input", exchange)
firstSelect.addEventListener("change", exchange)
secondSelect.addEventListener("change", exchange)
}
eventListeners()
UI.loading()
UI.getCurrencies(firstSelect, secondSelect)
function exchange() {
UI.loading()
UI.updateOutputs(firstSelect.value, secondSelect.value)
UI.exchange(amountElement.value, firstSelect.value, secondSelect.value, rate, date, result)
}