auto-retry for some forecast data

This commit is contained in:
Matt Walsh
2022-12-12 13:53:33 -06:00
parent 76fd93e6e1
commit 5dd8f4bd62
16 changed files with 101 additions and 36 deletions

View File

@@ -17,6 +17,7 @@ class WeatherDisplay {
this.loadingStatus = STATUS.loading;
this.name = name ?? elemId;
this.getDataCallbacks = [];
this.stillWaitingCallbacks = [];
this.defaultEnabled = defaultEnabled;
this.okToDrawCurrentConditions = true;
this.okToDrawCurrentDateTime = true;
@@ -392,6 +393,14 @@ class WeatherDisplay {
return template;
}
// still waiting for data (retries triggered)
stillWaiting() {
if (this.enabled) this.setStatus(STATUS.retrying);
// handle still waiting callbacks
this.stillWaitingCallbacks.forEach((callback) => callback());
this.stillWaitingCallbacks = [];
}
}
export default WeatherDisplay;