dasd
This commit is contained in:
No files matched your search
@@ -1,5 +1,5 @@
|
||||
// composables/useWebSocket.ts
|
||||
import { ref, computed, onUnmounted } from 'vue'
|
||||
import { ref, computed, onUnmounted, getCurrentInstance } from 'vue'
|
||||
|
||||
export interface WebSocketConfig {
|
||||
url: string
|
||||
@@ -168,9 +168,11 @@ export const useWebSocket = (config: WebSocketConfig) => {
|
||||
}
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
disconnect()
|
||||
})
|
||||
if (getCurrentInstance()) {
|
||||
onUnmounted(() => {
|
||||
disconnect()
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
ws: computed(() => ws.value),
|
||||
|
||||
Reference in New Issue
Block a user