📜  svelte on destroy - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:41.606000             🧑  作者: Mango

代码示例1
import { onDestroy } from 'svelte';

export function onInterval(callback, milliseconds) {
    const interval = setInterval(callback, milliseconds);

    onDestroy(() => {
        clearInterval(interval);
    });
}