set timer via config

master
Martin Zwigl 2024-08-01 18:02:19 +02:00
parent aae8479231
commit e9745a31c9
2 changed files with 5 additions and 3 deletions

View File

@ -1 +1 @@
refreshPeriodSec: 2
refreshPeriodSec: 10

View File

@ -19,13 +19,15 @@ interface Result {
}
(function() {
let totalIntervalInMillis: number = appConfig.default.refreshPeriodSec;
function show(this: { interval?: number; emit: (event: string) => void }) {
this.interval = setTimeout(() => {
this.emit("redraw");
this.interval = setInterval(() => {
this.emit("redraw");
}, 60000);
}, 60000 - (Date.now() % 60000));
}, totalIntervalInMillis);
}, totalIntervalInMillis - (Date.now() % totalIntervalInMillis));
}
function hide(this: { interval?: number }) {