mirror of
https://github.com/psforever/PSFPortal.git
synced 2026-07-14 07:54:53 +00:00
Cleanup setInterval on Home page
This commit is contained in:
parent
e5fadd5891
commit
f2be2504b9
2 changed files with 14 additions and 1 deletions
9
app/util/index.js
Normal file
9
app/util/index.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { onDestroy } from 'svelte';
|
||||
|
||||
export function onInterval(callback, milliseconds) {
|
||||
const interval = setInterval(callback, milliseconds);
|
||||
|
||||
onDestroy(() => {
|
||||
clearInterval(interval);
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue