(ws: WebSocketClient | null)
| 13 | |
| 14 | // 设置全局 WebSocket 实例(供其他 composable 使用) |
| 15 | export function setGlobalWebSocket(ws: WebSocketClient | null) { |
| 16 | wsInstance = ws; |
| 17 | isConnected.value = ws !== null; |
| 18 | } |
| 19 | |
| 20 | export function useWebSocket() { |
| 21 | const connect = async (url: string) => { |