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

Added support for multiple type declarations and cleaned up styling #17

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"./deno-deploy",
"./task-buffer",
"./tinyexec",
"./examples",
"./websocket"
]
}
7 changes: 0 additions & 7 deletions examples/deno.json

This file was deleted.

1 change: 0 additions & 1 deletion examples/mod.ts

This file was deleted.

29 changes: 0 additions & 29 deletions examples/use-message.ts

This file was deleted.

8 changes: 2 additions & 6 deletions websocket/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@ export interface WebSocketResource<T>
* console.log('event data: ', event.data);
* yield* each.next();
* }
*
* ```
*
* @param url - The URL of the target WebSocket server to connect to. The URL must use one of the following schemes: ws, wss, http, or https, and cannot include a URL fragment. If a relative URL is provided, it is relative to the base URL of the calling script. For more detail, see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/WebSocket#url
*
* @param prototol - A single string or an array of strings representing the sub-protocol(s) that the client would like to use, in order of preference. If it is omitted, an empty array is used by default, i.e. []. For more details, see

*
* @returns an operation yielding a {@link WebSocketResource}
*/
export function useWebSocket<T>(
Expand All @@ -66,7 +65,7 @@ export function useWebSocket<T>(
* Create a [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
* resource, but delegate the creation of the underlying websocket to a function
* of your choice. This is necessary on platforms that do not have a global
* `WebSocket` constructor such as NodeJS <= 20.
* `WebSocket` constructor such as NodeJS \<= 20.
*
* The resource will not be returned until a connection has been
* succesffuly established with the server and the
Expand Down Expand Up @@ -164,7 +163,4 @@ export function useWebSocket<T>(
});
}

/**
* @ignore until we can get jsdocs working for type unions
*/
export type WebSocketData = Parameters<WebSocket["send"]>[0];
Loading
Loading