Skip to content

Commit

Permalink
Merge pull request #17 from thefrontside/tm/improve-type-presentation
Browse files Browse the repository at this point in the history
Added support for multiple type declarations and cleaned up styling
  • Loading branch information
taras authored Oct 4, 2024
2 parents df6d765 + 97fb90a commit 949d5b2
Show file tree
Hide file tree
Showing 9 changed files with 238 additions and 121 deletions.
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

0 comments on commit 949d5b2

Please sign in to comment.