Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jun 15, 2023
1 parent 00a98f8 commit a356e4d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/vite/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function setupWebSocket(
'open',
() => {
isOpened = true
notifyListeners('vite:ws:connect', socket)
notifyListeners('vite:ws:connect', { webSocket: socket })
},
{ once: true },
)
Expand All @@ -100,7 +100,7 @@ function setupWebSocket(
return
}

notifyListeners('vite:ws:disconnect', socket)
notifyListeners('vite:ws:disconnect', { webSocket: socket })

console.log(`[vite] server connection lost. polling for restart...`)
await waitForSuccessfulPing(protocol, hostAndPath)
Expand Down
14 changes: 12 additions & 2 deletions packages/vite/types/customEvent.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,18 @@ export interface CustomEventMap {
'vite:beforeFullReload': FullReloadPayload
'vite:error': ErrorPayload
'vite:invalidate': InvalidatePayload
'vite:ws:connect': WebSocket
'vite:ws:disconnect': WebSocket
'vite:ws:connect': WebSocketConnectionPayload
'vite:ws:disconnect': WebSocketConnectionPayload
}

export interface WebSocketConnectionPayload {
/**
* @experimental
* We expose this instance experimentally to see potential usage.
* This might be removed in the future if we didn't find reasonable use cases.
* If you find this useful, please open an issue with details so we can discuss and make it stable API.
*/
webSocket: WebSocket
}

export interface InvalidatePayload {
Expand Down

0 comments on commit a356e4d

Please sign in to comment.