mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-07-16 19:50:48 +08:00
20 lines
393 B
TypeScript
20 lines
393 B
TypeScript
export const programStore = defineStore('program', () => {
|
|
const running = ref(false);
|
|
const timer = ref<NodeJS.Timer | null>(null);
|
|
|
|
const getStatus = async () => {
|
|
running.value = await apiProgram.status();
|
|
};
|
|
|
|
const onUpdate = () => {
|
|
getStatus();
|
|
timer.value = setInterval(() => getStatus(), 3000);
|
|
};
|
|
|
|
return {
|
|
running,
|
|
getStatus,
|
|
onUpdate,
|
|
};
|
|
});
|