Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(useWebSocket)!: rename type WebSocketOptions to UseWebSocketOptions and WebSocketResult to UseWebSocketReturn #1895

Merged
merged 1 commit into from Jul 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/core/useWebSocket/index.ts
Expand Up @@ -6,7 +6,7 @@ import { useEventListener } from '../useEventListener'

export type WebSocketStatus = 'OPEN' | 'CONNECTING' | 'CLOSED'

export interface WebSocketOptions {
export interface UseWebSocketOptions {
onConnected?: (ws: WebSocket) => void
onDisconnected?: (ws: WebSocket, event: CloseEvent) => void
onError?: (ws: WebSocket, event: Event) => void
Expand Down Expand Up @@ -83,7 +83,7 @@ export interface WebSocketOptions {
protocols?: string[]
}

export interface WebSocketResult<T> {
export interface UseWebSocketReturn<T> {
/**
* Reference to the latest data received via the websocket,
* can be watched to respond to incoming messages
Expand Down Expand Up @@ -135,8 +135,8 @@ function resolveNestedOptions<T>(options: T | true): T {
*/
export function useWebSocket<Data = any>(
url: string,
options: WebSocketOptions = {},
): WebSocketResult<Data> {
options: UseWebSocketOptions = {},
): UseWebSocketReturn<Data> {
const {
onConnected,
onDisconnected,
Expand Down