Skip to content

Commit 01cf6b9

Browse files
Katarina Antonkaciakmaciak
authored andcommitted
feat(helpers): deprecate fromEventSource and eventSource$ helpers
1 parent ec31f37 commit 01cf6b9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ TODO
5353
```TypeScript
5454
import { QueryClientProvider, QueryClient } from 'react-query';
5555
import { ReactQueryDevtools } from 'react-query/devtools';
56-
import { useSubscription, eventSource$ } from 'react-query-subscription';
56+
import { useSubscription } from 'react-query-subscription';
57+
import { eventSource$ } from 'rx-event-source';
5758

5859
const queryClient = new QueryClient();
5960

@@ -69,6 +70,7 @@ function App() {
6970
function SseExample() {
7071
const { data, isLoading, isError, error } = useSubscription(
7172
'some-key',
73+
// @see https://kaciakmaciak.github.io/rx-event-source/modules.html#eventSource_
7274
() => eventSource$('/api/v1/sse'),
7375
{
7476
// options
@@ -89,6 +91,8 @@ function SseExample() {
8991
}
9092
```
9193

94+
See [`rx-event-source` docs](https://kaciakmaciak.github.io/rx-event-source).
95+
9296
### GraphQL subscription using [`graphql-ws`](https://github.com/enisdenjo/graphql-ws)
9397

9498
```TypeScript

src/helpers/event-source.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export interface EventSourceOptions<TData = unknown> {
1717
/**
1818
* Takes EventSource and creates an observable from it.
1919
*
20+
* @deprecated Use `fromEventSource` from `rx-event-source` package instead.
21+
*
2022
* @example
2123
* ```ts
2224
* const sse = new EventSource(url, configuration);
@@ -60,6 +62,8 @@ export function fromEventSource<TData = unknown>(
6062
* Opens the event source once subscribed.
6163
* Closes the event source, once unsubscribed.
6264
*
65+
* @deprecated Use `eventSource$` from `rx-event-source` package instead.
66+
*
6367
* @example
6468
* ```ts
6569
* const sse$ = eventSource$('https://example.com/sse', {

0 commit comments

Comments
 (0)