fix types
This commit is contained in:
parent
5df22b67b6
commit
a93ef485c1
|
@ -27,14 +27,14 @@ const hasDisconnected = ref(false);
|
||||||
let timeoutId: number | null = null;
|
let timeoutId: number | null = null;
|
||||||
|
|
||||||
function onDisconnected() {
|
function onDisconnected() {
|
||||||
window.clearTimeout(timeoutId);
|
if (timeoutId != null) window.clearTimeout(timeoutId);
|
||||||
timeoutId = window.setTimeout(() => {
|
timeoutId = window.setTimeout(() => {
|
||||||
hasDisconnected.value = true;
|
hasDisconnected.value = true;
|
||||||
}, 1000 * 10);
|
}, 1000 * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetDisconnected() {
|
function resetDisconnected() {
|
||||||
window.clearTimeout(timeoutId);
|
if (timeoutId != null) window.clearTimeout(timeoutId);
|
||||||
hasDisconnected.value = false;
|
hasDisconnected.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ useStream().on('_connected_', resetDisconnected);
|
||||||
useStream().on('_disconnected_', onDisconnected);
|
useStream().on('_disconnected_', onDisconnected);
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
window.clearTimeout(timeoutId);
|
if (timeoutId != null) window.clearTimeout(timeoutId);
|
||||||
useStream().off('_connected_', resetDisconnected);
|
useStream().off('_connected_', resetDisconnected);
|
||||||
useStream().off('_disconnected_', onDisconnected);
|
useStream().off('_disconnected_', onDisconnected);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue