displaying 'Loading...' text while ajax requesting

This commit is contained in:
frankknoll
2023-01-28 22:30:29 +01:00
parent a88059f754
commit a32a74c297

View File

@@ -7,10 +7,12 @@ class HistogramView {
} }
displayHistogramsForBatchcode(batchcode) { displayHistogramsForBatchcode(batchcode) {
// FK-TODO: zeige "Loading..." bis Daten geladen sind. const loadingText = document.createTextNode('Loading...');
this.#uiContainer.appendChild(loadingText);
fetch(`data/histograms/${batchcode}.json`) fetch(`data/histograms/${batchcode}.json`)
.then(response => response.json()) .then(response => response.json())
.then(histoDescrs => { .then(histoDescrs => {
loadingText.remove();
for (const histoDescr of histoDescrs.histograms) { for (const histoDescr of histoDescrs.histograms) {
const canvas = document.createElement("canvas"); const canvas = document.createElement("canvas");
this.#uiContainer.appendChild(canvas); this.#uiContainer.appendChild(canvas);