refactor championship changed update check
This commit is contained in:
@@ -24,6 +24,13 @@ export default class Championship {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get nextChanged() {
|
||||||
|
if (Championship.last?.day != Championship.next?.day || Championship.last?.time != Championship.next?.time) {
|
||||||
|
Championship.last = Championship.next
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static firstTimeOnDay(day) {
|
static firstTimeOnDay(day) {
|
||||||
return Math.min(...Object.keys(Data.championships[day]))
|
return Math.min(...Object.keys(Data.championships[day]))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
import UI from './ui.js'
|
import UI from './ui.js'
|
||||||
|
import Championship from './championship.js'
|
||||||
|
|
||||||
|
window.Championship = Championship
|
||||||
|
|
||||||
window.addEventListener('load', UI.init)
|
window.addEventListener('load', UI.init)
|
||||||
|
|||||||
@@ -40,8 +40,7 @@ export default class UI {
|
|||||||
|
|
||||||
let next = Championship.next
|
let next = Championship.next
|
||||||
|
|
||||||
if (Championship.last != next) {
|
if (Championship.nextChanged) {
|
||||||
Championship.last = next
|
|
||||||
this.updateChampionshipDetails(next)
|
this.updateChampionshipDetails(next)
|
||||||
this.updateChampionshipTable(next)
|
this.updateChampionshipTable(next)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user