@yorkie-js/react 0.6.5 → 0.6.6

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.
@@ -3,6 +3,7 @@ import { Indexable } from '@yorkie-js/sdk';
3
3
  import { JSONArray } from '@yorkie-js/sdk';
4
4
  import { JSONObject } from '@yorkie-js/sdk';
5
5
  import { JSX } from 'react/jsx-dev-runtime';
6
+ import { Presence } from '@yorkie-js/sdk';
6
7
  import { PropsWithChildren } from 'react';
7
8
  import { StreamConnectionStatus } from '@yorkie-js/sdk';
8
9
 
@@ -38,7 +39,7 @@ export declare const useDocument: <R, P extends Indexable = Indexable>() => {
38
39
  presence: P;
39
40
  }[];
40
41
  connection: StreamConnectionStatus;
41
- update: (callback: (root: R, presence: P) => void) => void;
42
+ update: (callback: (root: R, presence: Presence<P>) => void) => void;
42
43
  loading: boolean;
43
44
  error: Error | undefined;
44
45
  };
@@ -60,18 +61,25 @@ export declare const useRoot: () => {
60
61
  };
61
62
 
62
63
  /**
63
- * `useYorkieDoc` is a custom hook that initializes a Yorkie client and attaches a document.
64
+ * `useYorkieDoc` is a custom hook that initializes a Yorkie Client and a
65
+ * document in a single hook.
64
66
  *
65
67
  * @param apiKey
66
68
  * @param docKey
67
- * @param initialRoot
68
69
  * @returns
69
70
  */
70
- export declare function useYorkieDoc<T>(apiKey: string, docKey: string, initialRoot: T, options?: {
71
+ export declare function useYorkieDoc<R, P extends Indexable>(apiKey: string, docKey: string, options?: {
72
+ initialRoot?: R;
73
+ initialPresence?: P;
71
74
  rpcAddr?: string;
72
75
  }): {
73
- root: T;
74
- update: (callback: (root: T) => void) => void;
76
+ root: R;
77
+ presences: Array<{
78
+ clientID: string;
79
+ presence: P;
80
+ }>;
81
+ connection: StreamConnectionStatus;
82
+ update: (callback: (root: R, presence: Presence<P>) => void) => void;
75
83
  loading: boolean;
76
84
  error: Error | undefined;
77
85
  };