mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-25 17:42:25 +01:00
16 lines
308 B
Go
16 lines
308 B
Go
import { onBeforeUnmount, onMounted } from 'vue';
|
|
|
|
export const setupAutoUpdate = (
|
|
fn: Function,
|
|
interval?: number,
|
|
handle?: number
|
|
) => {
|
|
if (!interval) interval = 5000;
|
|
onMounted(() => {
|
|
handle = setInterval(fn, interval);
|
|
});
|
|
onBeforeUnmount(() => {
|
|
clearInterval(handle);
|
|
});
|
|
};
|