From e9745a31c92c3fab26800ad6f20dda2d07b928e1 Mon Sep 17 00:00:00 2001 From: Martin Zwigl Date: Thu, 1 Aug 2024 18:02:19 +0200 Subject: [PATCH] :sparkles: set timer via config --- apps_ts/papam_clockinfo_tests/app-config.yaml | 2 +- apps_ts/papam_clockinfo_tests/src/app.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps_ts/papam_clockinfo_tests/app-config.yaml b/apps_ts/papam_clockinfo_tests/app-config.yaml index ba54ad573..a05b8c520 100644 --- a/apps_ts/papam_clockinfo_tests/app-config.yaml +++ b/apps_ts/papam_clockinfo_tests/app-config.yaml @@ -1 +1 @@ -refreshPeriodSec: 2 \ No newline at end of file +refreshPeriodSec: 10 \ No newline at end of file diff --git a/apps_ts/papam_clockinfo_tests/src/app.ts b/apps_ts/papam_clockinfo_tests/src/app.ts index 616922da3..9d344b9b9 100644 --- a/apps_ts/papam_clockinfo_tests/src/app.ts +++ b/apps_ts/papam_clockinfo_tests/src/app.ts @@ -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 }) {