Typescript enhancements, fixed character disconnect emit
This commit is contained in:
@ -32,7 +32,7 @@
|
||||
<script setup lang="ts">
|
||||
import config from '@/config'
|
||||
import 'phaser'
|
||||
import { onUnmounted, watch, ref } from 'vue'
|
||||
import { onUnmounted, watch, ref, onBeforeUnmount } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { Game, Scene } from 'phavuer'
|
||||
import { useGameStore } from '@/stores/game'
|
||||
@ -52,12 +52,7 @@ const assetStore = useAssetStore()
|
||||
const isLoaded = ref(false)
|
||||
const { assets } = storeToRefs(assetStore)
|
||||
|
||||
onUnmounted(() => {
|
||||
gameStore.disconnectSocket()
|
||||
})
|
||||
|
||||
// On page close
|
||||
addEventListener('beforeunload', () => {
|
||||
onBeforeUnmount(() => {
|
||||
gameStore.disconnectSocket()
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user