Fixed bad function ref

This commit is contained in:
Daniel Ledda
2020-11-29 12:09:50 +01:00
parent 1f2df8b069
commit 16b4be1cd4
3 changed files with 5 additions and 5 deletions

2
webapp/dist/main.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -52,13 +52,12 @@ class ClimateChart {
throw new Error(`improper HTML element passed, needed type canvas, got ${canvasElement.tagName}`);
}
this.chart = new Chart(ctx, generateClimateChartConfig({}));
setInterval(this.doUpdateInterval, 30 * 1000);
await this.doUpdateInterval();
await this.update();
this.onLoadedCallback();
}
private async doUpdateInterval() {
await this.updateFromServer().catch(e => this.logError(e));
async update() {
return this.updateFromServer().catch(e => this.logError(e));
}
private async getNewSnapshots(): Promise<SnapshotRecords> {

View File

@@ -32,6 +32,7 @@ document.onreadystatechange = (e) => {
const climateChart = createClimateChart();
climateChart.onLoaded(() => {
overlay.classList.add('hidden');
setInterval(() => climateChart.update(), 30 * 1000);
});
climateChart.onErrored((e) => {
overlay.classList.remove('hidden');