Cleanup setInterval on Home page

This commit is contained in:
Chord 2020-05-14 20:22:09 +02:00
parent e5fadd5891
commit f2be2504b9
2 changed files with 14 additions and 1 deletions

9
app/util/index.js Normal file
View file

@ -0,0 +1,9 @@
import { onDestroy } from 'svelte';
export function onInterval(callback, milliseconds) {
const interval = setInterval(callback, milliseconds);
onDestroy(() => {
clearInterval(interval);
});
}