mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-28 22:49:24 +09:00
サーバーから切断された後 stream indicator をすぐに表示しないようにする (MisskeyIO#172)
すぐに再接続されたら表示しないように
This commit is contained in:
parent
b784983a8e
commit
3717666807
@ -24,12 +24,17 @@ import { defaultStore } from '@/store';
|
|||||||
const zIndex = os.claimZIndex('high');
|
const zIndex = os.claimZIndex('high');
|
||||||
|
|
||||||
let hasDisconnected = $ref(false);
|
let hasDisconnected = $ref(false);
|
||||||
|
let timeoutId = $ref<number>();
|
||||||
|
|
||||||
function onDisconnected() {
|
function onDisconnected() {
|
||||||
|
window.clearTimeout(timeoutId);
|
||||||
|
timeoutId = window.setTimeout(() => {
|
||||||
hasDisconnected = true;
|
hasDisconnected = true;
|
||||||
|
}, 1000 * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetDisconnected() {
|
function resetDisconnected() {
|
||||||
|
window.clearTimeout(timeoutId);
|
||||||
hasDisconnected = false;
|
hasDisconnected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,9 +42,12 @@ function reload() {
|
|||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useStream().on('_connected_', resetDisconnected);
|
||||||
useStream().on('_disconnected_', onDisconnected);
|
useStream().on('_disconnected_', onDisconnected);
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
window.clearTimeout(timeoutId);
|
||||||
|
useStream().off('_connected_', resetDisconnected);
|
||||||
useStream().off('_disconnected_', onDisconnected);
|
useStream().off('_disconnected_', onDisconnected);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user