mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
fix watchers and intervals.
This commit is contained in:
parent
c8c7df7c3c
commit
4b1fbbf836
@ -561,7 +561,7 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
|
||||
let packetsLost: number
|
||||
let packetsReceived: number
|
||||
|
||||
const timer = setInterval(async () => {
|
||||
const timer = window.setInterval(async () => {
|
||||
if (!this._peer) return
|
||||
|
||||
let stats: RTCStatsReport | undefined = undefined
|
||||
@ -620,7 +620,7 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
|
||||
}, ms)
|
||||
|
||||
return function () {
|
||||
clearInterval(timer)
|
||||
window.clearInterval(timer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -243,12 +243,9 @@ const is_touch_device = computed(() => {
|
||||
)
|
||||
})
|
||||
|
||||
watch(
|
||||
() => private_mode_enabled.value,
|
||||
(enabled) => {
|
||||
connection.webrtc.paused = enabled
|
||||
},
|
||||
)
|
||||
watch(private_mode_enabled, (enabled) => {
|
||||
connection.webrtc.paused = enabled
|
||||
})
|
||||
|
||||
const screencastReady = ref(false)
|
||||
const screencast = computed(() => {
|
||||
@ -304,13 +301,9 @@ function setUrl(url: string) {
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.server,
|
||||
(url) => {
|
||||
url && setUrl(url)
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
watch(() => props.server, (url) => {
|
||||
url && setUrl(url)
|
||||
}, { immediate: true })
|
||||
|
||||
async function authenticate(token?: string) {
|
||||
if (!token) {
|
||||
|
@ -722,7 +722,9 @@ function restartInactiveCursorInterval() {
|
||||
}
|
||||
}
|
||||
|
||||
watch([focused, props.isControling, props.inactiveCursors], restartInactiveCursorInterval)
|
||||
watch(focused, restartInactiveCursorInterval)
|
||||
watch(() => props.inactiveCursors, restartInactiveCursorInterval)
|
||||
watch(() => props.isControling, restartInactiveCursorInterval)
|
||||
|
||||
function saveInactiveMousePos(e: MouseEvent) {
|
||||
const pos = getMousePos(e.clientX, e.clientY)
|
||||
|
@ -629,13 +629,13 @@ function screenChangingToggle() {
|
||||
let sizes = props.neko.state.screen.configurations
|
||||
let len = sizes.length
|
||||
|
||||
screen_interval = setInterval(() => {
|
||||
screen_interval = window.setInterval(() => {
|
||||
let { width, height, rate } = sizes[Math.floor(Math.random() * len)]
|
||||
|
||||
props.neko.setScreenSize(width, height, rate)
|
||||
}, 10)
|
||||
} else {
|
||||
clearInterval(screen_interval)
|
||||
window.clearInterval(screen_interval)
|
||||
screen_interval = null
|
||||
}
|
||||
}
|
||||
@ -646,7 +646,7 @@ function setScreenConfiguration() {
|
||||
props.neko.setScreenSize(parseInt(width), parseInt(height), parseInt(rate))
|
||||
}
|
||||
|
||||
watch(props.neko.state.screen.size, (val) => {
|
||||
watch(() => props.neko.state.screen.size, (val) => {
|
||||
screenConfiguration.value = `${val.width}x${val.height}@${val.rate}`
|
||||
})
|
||||
|
||||
@ -656,14 +656,14 @@ function cursorMovingToggle() {
|
||||
if (cursor_interval === null) {
|
||||
let len = props.neko.state.screen.size.width
|
||||
|
||||
cursor_interval = setInterval(() => {
|
||||
cursor_interval = window.setInterval(() => {
|
||||
let x = Math.floor(Math.random() * len)
|
||||
let y = Math.floor(Math.random() * len)
|
||||
|
||||
props.neko.control.move({ x, y })
|
||||
}, 10)
|
||||
} else {
|
||||
clearInterval(cursor_interval)
|
||||
window.clearInterval(cursor_interval)
|
||||
cursor_interval = null
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user