Autorefresh

public/javascripts/datetiume.js
   - added parameter 'params'
   - refresh all graphics aftter refreshrate

public/javascripts/global.js
   - call showDate with params
This commit is contained in:
rxf
2023-05-24 23:00:15 +02:00
parent 3921a889a2
commit b485c08227
4 changed files with 19 additions and 8 deletions
+14 -2
View File
@@ -1,13 +1,25 @@
// all date and time functions
import { DateTime } from './luxon.min.js'
import {loadAll, showChart, setNoUTC} from './showcharts.js'
import {getCurrentTab} from "./chart_utilities.js";
// Show date and time (every minute)
export const showDate = (sofort) => {
// Will be called every second
export const showDate = (sofort, params) => {
let d = DateTime.now()
if(sofort || d.second === 0) {
document.querySelector('#h1datum').innerHTML = d.toFormat('yyyy-MM-dd HH:mm')
}
if (((d.minute % params.refreshRate) == 0) && (d.second == 15)) { // alle ganzen refreshRate Minuten, 15sec danach
let start = 1
console.log(params.refreshRate, 'Minuten um, Grafik wird erneuert');
let ct = getCurrentTab()
if (ct === 'maptab') {
start = 0
}
loadAll(params, start)
}
}
/* ToDo: