Skip to content

Commit

Permalink
feat(ws-client): allow change reactive for state, filesMap and idMap (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin authored Jun 17, 2024
1 parent 0dda80e commit e6020b9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/ws-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface VitestClientOptions {
reconnectInterval?: number
reconnectTries?: number
connectTimeout?: number
reactive?: <T>(v: T) => T
reactive?: <T>(v: T, forKey: 'state' | 'idMap' | 'filesMap') => T
ref?: <T>(v: T) => { value: T }
WebSocketConstructor?: typeof WebSocket
}
Expand Down Expand Up @@ -44,10 +44,10 @@ export function createClient(url: string, options: VitestClientOptions = {}) {
state: new StateManager(),
waitForConnection,
reconnect,
}) as VitestClient
}, 'state') as VitestClient

ctx.state.filesMap = reactive(ctx.state.filesMap)
ctx.state.idMap = reactive(ctx.state.idMap)
ctx.state.filesMap = reactive(ctx.state.filesMap, 'filesMap')
ctx.state.idMap = reactive(ctx.state.idMap, 'idMap')

let onMessage: Function
const functions: WebSocketEvents = {
Expand Down

0 comments on commit e6020b9

Please sign in to comment.