@yorkie-js/react 0.7.6 → 0.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@ To get started using Yorkie React SDK, see: https://yorkie.dev/docs/getting-star
8
8
 
9
9
  ## Contributing
10
10
 
11
- See [CONTRIBUTING](CONTRIBUTING.md) for details on submitting patches and the contribution workflow.
11
+ See [CONTRIBUTING](../../CONTRIBUTING.md) for details on submitting patches and the contribution workflow.
12
12
 
13
13
  ## Contributors ✨
14
14
 
@@ -10,6 +10,7 @@ import { Presence } from '@yorkie-js/sdk';
10
10
  import { PropsWithChildren } from 'react';
11
11
  import { RevisionSummary } from '@yorkie-js/sdk';
12
12
  import { StreamConnectionStatus } from '@yorkie-js/sdk';
13
+ import { SyncMode } from '@yorkie-js/sdk';
13
14
  import { Text as Text_2 } from '@yorkie-js/sdk';
14
15
  import { Tree } from '@yorkie-js/sdk';
15
16
 
@@ -19,12 +20,17 @@ import { Tree } from '@yorkie-js/sdk';
19
20
  *
20
21
  * @example
21
22
  * ```tsx
23
+ * import { ChannelProvider, SyncMode } from '@yorkie-js/react';
24
+ *
22
25
  * <YorkieProvider apiKey="..." rpcAddr="...">
23
- * <ChannelProvider channelKey="room-123" isRealtime={true}>
26
+ * <ChannelProvider channelKey="room-123" syncMode={SyncMode.Realtime}>
24
27
  * <ChatRoom />
25
28
  * </ChannelProvider>
26
29
  * </YorkieProvider>
27
30
  * ```
31
+ *
32
+ * The boolean `isRealtime` prop is also accepted as a shortcut for
33
+ * the Realtime/Manual choice (`true` → Realtime, `false` → Manual).
28
34
  */
29
35
  export declare const ChannelProvider: React.FC<ChannelProviderProps>;
30
36
 
@@ -37,10 +43,24 @@ declare type ChannelProviderProps = PropsWithChildren<{
37
43
  */
38
44
  channelKey: string;
39
45
  /**
40
- * `isRealtime` determines the synchronization mode.
41
- * - true: Realtime mode (automatic updates via watch stream)
42
- * - false: Manual mode (requires manual sync)
43
- * @default true
46
+ * `syncMode` selects how the channel keeps presence in sync with the server.
47
+ * - `SyncMode.Realtime` (default): open a watch stream and run the
48
+ * heartbeat. Required to receive broadcast events.
49
+ * - `SyncMode.Polling`: heartbeat-only. No watch stream is opened.
50
+ * Recommended for large channels where broadcast is not needed.
51
+ * - `SyncMode.Manual`: no automatic activity.
52
+ *
53
+ * If `isRealtime` is also set, `syncMode` wins.
54
+ */
55
+ syncMode?: SyncMode;
56
+ /**
57
+ * `isRealtime` is a convenience prop covering only Realtime/Manual.
58
+ * - `true`: equivalent to `syncMode={SyncMode.Realtime}`.
59
+ * - `false`: equivalent to `syncMode={SyncMode.Manual}`.
60
+ *
61
+ * Use `syncMode` directly when you want `SyncMode.Polling`, which this
62
+ * boolean prop cannot express. When neither prop is set, the channel
63
+ * falls back to `SyncMode.Realtime`.
44
64
  */
45
65
  isRealtime?: boolean;
46
66
  }>;
@@ -92,6 +112,8 @@ export { RevisionSummary }
92
112
  */
93
113
  export declare function shallowEqual<T>(valueA: T, valueB: T): boolean;
94
114
 
115
+ export { SyncMode }
116
+
95
117
  export { Text_2 as Text }
96
118
 
97
119
  export { Tree }