2021-05-17 00:27:47 +02:00
|
|
|
|
<template>
|
2021-05-15 20:04:30 +02:00
|
|
|
|
<div class="overlay connection-lost" v-if="show">
|
|
|
|
|
|
<div class="overlay-content" v-if="lostConnection">
|
|
|
|
|
|
<div>⁉️ LOST CONNECTION ⁉️</div>
|
|
|
|
|
|
<span class="btn" @click="$emit('reconnect')">Reconnect</span>
|
|
|
|
|
|
</div>
|
2021-05-15 23:38:14 +02:00
|
|
|
|
<div class="overlay-content" v-if="connecting">
|
2021-05-15 20:04:30 +02:00
|
|
|
|
<div>Connecting...</div>
|
|
|
|
|
|
</div>
|
2021-05-17 00:27:47 +02:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
|
import { defineComponent } from 'vue'
|
|
|
|
|
|
|
|
|
|
|
|
import Communication from './../Communication'
|
|
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
|
name: 'connection-overlay',
|
2021-05-15 20:04:30 +02:00
|
|
|
|
emits: {
|
|
|
|
|
|
reconnect: null,
|
|
|
|
|
|
},
|
|
|
|
|
|
props: {
|
|
|
|
|
|
connectionState: Number,
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
2021-05-17 00:27:47 +02:00
|
|
|
|
lostConnection (): boolean {
|
2021-05-15 20:04:30 +02:00
|
|
|
|
return this.connectionState === Communication.CONN_STATE_DISCONNECTED
|
|
|
|
|
|
},
|
2021-05-17 00:27:47 +02:00
|
|
|
|
connecting (): boolean {
|
2021-05-15 20:04:30 +02:00
|
|
|
|
return this.connectionState === Communication.CONN_STATE_CONNECTING
|
|
|
|
|
|
},
|
2021-05-17 00:27:47 +02:00
|
|
|
|
show (): boolean {
|
|
|
|
|
|
return !!(this.lostConnection || this.connecting)
|
2021-05-15 20:04:30 +02:00
|
|
|
|
},
|
|
|
|
|
|
}
|
2021-05-17 00:27:47 +02:00
|
|
|
|
})
|
|
|
|
|
|
</script>
|