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

View File

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