From 10a7369fecf852546c93e10936dacb3ef99e91fd Mon Sep 17 00:00:00 2001 From: tamaina Date: Tue, 11 Feb 2020 22:57:09 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B5=E3=83=BC=E3=83=90=E3=83=BC=E3=81=8B?= =?UTF-8?q?=E3=82=89=E5=88=87=E6=96=AD=E3=81=95=E3=82=8C=E3=81=BE=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=81=AE=E3=83=80=E3=82=A4=E3=82=A2=E3=83=AD=E3=82=B0?= =?UTF-8?q?=E3=81=AF=E6=99=82=E9=96=93=E3=82=92=E3=81=8A=E3=81=84=E3=81=A6?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=20(#5916)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * timeout disconnect dialog * 70ms * 150ms --- src/client/app.vue | 16 ++++++++++------ src/client/scripts/stream.ts | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/client/app.vue b/src/client/app.vue index 32283bd20..7b4796d74 100644 --- a/src/client/app.vue +++ b/src/client/app.vue @@ -247,11 +247,15 @@ export default Vue.extend({ } this.$root.stream.on('_disconnected_', () => { - if (!this.disconnectedDialog) { - if (this.$store.state.device.autoReload) { - location.reload(); - return; - } + if (this.disconnectedDialog) return; + if (this.$store.state.device.autoReload) { + location.reload(); + return; + } + + setTimeout(() => { + if (this.$root.stream.state !== 'reconnecting') return; + this.disconnectedDialog = this.$root.dialog({ type: 'warning', showCancelButton: true, @@ -263,7 +267,7 @@ export default Vue.extend({ } this.disconnectedDialog = null; }); - } + }, 150) }); }, diff --git a/src/client/scripts/stream.ts b/src/client/scripts/stream.ts index 7f0e1280b..18bb7c13d 100644 --- a/src/client/scripts/stream.ts +++ b/src/client/scripts/stream.ts @@ -9,7 +9,7 @@ import MiOS from '../mios'; */ export default class Stream extends EventEmitter { private stream: ReconnectingWebsocket; - public state: string; + public state: 'initializing' | 'reconnecting' | 'connected'; private sharedConnectionPools: Pool[] = []; private sharedConnections: SharedConnection[] = []; private nonSharedConnections: NonSharedConnection[] = [];