diff --git a/src/component/internal/webrtc.ts b/src/component/internal/webrtc.ts index 648d7a77..a736594d 100644 --- a/src/component/internal/webrtc.ts +++ b/src/component/internal/webrtc.ts @@ -561,7 +561,7 @@ export class NekoWebRTC extends EventEmitter { 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 { }, ms) return function () { - clearInterval(timer) + window.clearInterval(timer) } } } diff --git a/src/component/main.vue b/src/component/main.vue index eaee6547..16dd7f5b 100644 --- a/src/component/main.vue +++ b/src/component/main.vue @@ -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) { diff --git a/src/component/overlay.vue b/src/component/overlay.vue index c677e64b..7ebbf965 100644 --- a/src/component/overlay.vue +++ b/src/component/overlay.vue @@ -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) diff --git a/src/page/components/events.vue b/src/page/components/events.vue index 9f8b642f..a97da25a 100644 --- a/src/page/components/events.vue +++ b/src/page/components/events.vue @@ -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 } }