v0.2.1! Adds instant Hazard List updates after hazard sync
Some checks are pending
build-docker / Build Image (push) Waiting to run
Some checks are pending
build-docker / Build Image (push) Waiting to run
This commit is contained in:
parent
0f2d64b908
commit
dbb32fd2f9
9 changed files with 362 additions and 5 deletions
|
|
@ -8,11 +8,17 @@ class HazardList extends WeatherDisplay {
|
|||
constructor(navId, elemId) {
|
||||
super(navId, elemId, 'Hazard List', true);
|
||||
this.history = [];
|
||||
this.handleHazardHistoryUpdated = this.handleHazardHistoryUpdated.bind(this);
|
||||
window.addEventListener('hazard-history-updated', this.handleHazardHistoryUpdated);
|
||||
}
|
||||
|
||||
async getData(weatherParameters, refresh) {
|
||||
const superResult = super.getData(weatherParameters, refresh);
|
||||
await this.refreshHistoryNow();
|
||||
return superResult;
|
||||
}
|
||||
|
||||
async refreshHistoryNow() {
|
||||
try {
|
||||
// Fetch hazard history from backend
|
||||
const response = await fetch(withBasePath('api/hazard-history'));
|
||||
|
|
@ -37,8 +43,13 @@ class HazardList extends WeatherDisplay {
|
|||
this.setStatus(STATUS.failed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return superResult;
|
||||
async handleHazardHistoryUpdated() {
|
||||
await this.refreshHistoryNow();
|
||||
if (this.active) {
|
||||
this.drawCanvas();
|
||||
}
|
||||
}
|
||||
|
||||
async drawCanvas() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue