From 0161b8113865165afb5988a1843cae9d16e58119 Mon Sep 17 00:00:00 2001 From: Ticruz Date: Wed, 6 Nov 2024 12:10:15 +0100 Subject: [PATCH] clearInterval on store --- src/util/misc.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/misc.ts b/src/util/misc.ts index bd372a45..04350a59 100644 --- a/src/util/misc.ts +++ b/src/util/misc.ts @@ -7,9 +7,10 @@ import Fuse from "fuse.js" import logger from "src/util/logger" export const timestamp1: Readable = derived([], (_, set) => { - setInterval(() => { + const interval = setInterval(() => { set(Math.floor(Date.now() / 1000)) }, 1000) + return () => clearInterval(interval) }) export const secondsToDate = ts => new Date(parseInt(ts) * 1000)