From 2d979684453659318daf794febafb0887a12fb50 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:35:20 +1100 Subject: config: dynamic service confs --- src/services/updates.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/services/updates.ts') diff --git a/src/services/updates.ts b/src/services/updates.ts index 9c4abe1..06e86b1 100644 --- a/src/services/updates.ts +++ b/src/services/updates.ts @@ -151,7 +151,7 @@ export default class Updates extends GObject.Object { this.notify("loading"); this.#timeout?.destroy(); - this.#timeout = setTimeout(() => this.getUpdates(), config.interval); + this.#timeout = setTimeout(() => this.getUpdates(), config.interval.get()); }) .catch(console.error); } @@ -164,5 +164,10 @@ export default class Updates extends GObject.Object { writeFileAsync(this.#cachePath, JSON.stringify(this.#data)).catch(console.error) ); this.getUpdates(); + + config.interval.subscribe(i => { + this.#timeout?.destroy(); + this.#timeout = setTimeout(() => this.getUpdates(), i); + }); } } -- cgit v1.2.3-freya