サーバーから切断された後 stream indicator をすぐに表示しないようにする (MisskeyIO#172)
すぐに再接続されたら表示しないように
This commit is contained in:
parent
15ae1605ec
commit
5df22b67b6
|
@ -24,12 +24,17 @@ import { defaultStore } from '@/store.js';
|
|||
const zIndex = os.claimZIndex('high');
|
||||
|
||||
const hasDisconnected = ref(false);
|
||||
let timeoutId: number | null = null;
|
||||
|
||||
function onDisconnected() {
|
||||
hasDisconnected.value = true;
|
||||
window.clearTimeout(timeoutId);
|
||||
timeoutId = window.setTimeout(() => {
|
||||
hasDisconnected.value = true;
|
||||
}, 1000 * 10);
|
||||
}
|
||||
|
||||
function resetDisconnected() {
|
||||
window.clearTimeout(timeoutId);
|
||||
hasDisconnected.value = false;
|
||||
}
|
||||
|
||||
|
@ -37,9 +42,12 @@ function reload() {
|
|||
location.reload();
|
||||
}
|
||||
|
||||
useStream().on('_connected_', resetDisconnected);
|
||||
useStream().on('_disconnected_', onDisconnected);
|
||||
|
||||
onUnmounted(() => {
|
||||
window.clearTimeout(timeoutId);
|
||||
useStream().off('_connected_', resetDisconnected);
|
||||
useStream().off('_disconnected_', onDisconnected);
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue