add obs checker

This commit is contained in:
2024-02-21 12:35:24 +08:00
parent cc778d22b4
commit 6317699f6c
10 changed files with 77 additions and 14 deletions

View File

@@ -44,14 +44,25 @@ async function getUsers() {
} as UpdateLiveLotteryUsersModel
}
const visiable = ref(true)
const active = ref(true)
let timer: any
onMounted(() => {
timer = setInterval(async () => {
if (!visiable.value || !active.value) return
const r = await getUsers()
if (r) {
result.value = r
}
}, 2000)
//@ts-expect-error 这里获取不了
window.obsstudio.onVisibilityChange = function (visibility: boolean) {
visiable.value = visibility
}
//@ts-expect-error 这里获取不了
window.obsstudio.onActiveChange = function (a: boolean) {
active.value = a
}
})
onUnmounted(() => {
clearInterval(timer)