@automerge/automerge-repo-react-hooks 2.5.2-alpha.1 → 2.5.2-alpha.2
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/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/usePresence.d.ts +24 -0
- package/dist/usePresence.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/usePresence.ts +37 -0
package/dist/index.js
CHANGED
|
@@ -7177,6 +7177,15 @@ function usePresence({
|
|
|
7177
7177
|
presence.stop();
|
|
7178
7178
|
};
|
|
7179
7179
|
}, [presence, userId, deviceId, firstInitialState, firstOpts]);
|
|
7180
|
+
const start = useCallback(() => {
|
|
7181
|
+
presence.start({
|
|
7182
|
+
initialState: presence.getLocalState(),
|
|
7183
|
+
...firstOpts.current
|
|
7184
|
+
});
|
|
7185
|
+
}, [presence, firstOpts]);
|
|
7186
|
+
const stop = useCallback(() => {
|
|
7187
|
+
presence.stop();
|
|
7188
|
+
}, [presence]);
|
|
7180
7189
|
const update = useCallback(
|
|
7181
7190
|
(channel, msg) => {
|
|
7182
7191
|
presence.broadcast(channel, msg);
|
|
@@ -7188,7 +7197,9 @@ function usePresence({
|
|
|
7188
7197
|
return {
|
|
7189
7198
|
peerStates,
|
|
7190
7199
|
localState,
|
|
7191
|
-
update
|
|
7200
|
+
update,
|
|
7201
|
+
start,
|
|
7202
|
+
stop
|
|
7192
7203
|
};
|
|
7193
7204
|
}
|
|
7194
7205
|
|