Weather: fixed polling + improved WeatherCard with a NBusyIndicator if not ready yet

This commit is contained in:
quadbyte 2025-08-11 22:17:17 -04:00
parent 03687f95f3
commit 4fc4c94a47
3 changed files with 30 additions and 6 deletions

View file

@ -41,9 +41,11 @@ Singleton {
}
}
// Every minute check if we need to fetch new weather
Timer {
id: updateTimer
interval: 60 * 1000
running: true
repeat: true
onTriggered: {
updateWeather()
@ -51,7 +53,9 @@ Singleton {
}
// --------------------------------
function init() {// does nothing but ensure the singleton is created
function init() {
// does nothing but ensure the singleton is created
// do not remove
}
// --------------------------------
@ -60,11 +64,15 @@ Singleton {
data.longitude = ""
data.weatherLastFetch = 0
data.weather = null
// Try to fetch immediately
updateWeather();
}
// --------------------------------
function updateWeather() {
if (isFetchingWeather) {
console.warn("Weather is still fetching")
return
}