forked from noxious/client
Replaced all event names with numbers for less bandwidth usage
This commit is contained in:
@ -10,6 +10,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { SocketEvent } from '@/application/enums';
|
||||
import Modal from '@/components/utilities/Modal.vue'
|
||||
import { useGameStore } from '@/stores/gameStore'
|
||||
import { onBeforeMount, onBeforeUnmount, onMounted, onUnmounted, watch } from 'vue'
|
||||
@ -26,7 +27,7 @@ type Notification = {
|
||||
}
|
||||
|
||||
function setupNotificationListener(connection: any) {
|
||||
connection.on('notification', (data: Notification) => {
|
||||
connection.on(SocketEvent.NOTIFICATION, (data: Notification) => {
|
||||
gameStore.addNotification({
|
||||
title: data.title,
|
||||
message: data.message
|
||||
@ -52,7 +53,7 @@ onMounted(() => {
|
||||
onUnmounted(() => {
|
||||
const connection = gameStore.connection
|
||||
if (connection) {
|
||||
connection.off('notification')
|
||||
connection.off(SocketEvent.NOTIFICATION)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user