Spaces:
Runtime error
Runtime error
File size: 632 Bytes
423b87b 3d2cb9e 423b87b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import { useMyPresence } from "./useMyPresence";
/**
* Works similarly to `liveblocks-react` useUpdateMyPresence
* https://liveblocks.io/docs/api-reference/liveblocks-react#useUpdateMyPresence
*
* const updateMyPresence = useUpdateMyPresence()
* updateMyPresence({ name: 'Chris' })
*
*
* Can also import useMyPresence instead and use .update() instead:
*
* const myPresence = useMyPresence()
* myPresence.update({ name: 'Chris' })
*/
export function useUpdateMyPresence(): (val: any) => void {
const presence = useMyPresence({ addToHistory: true });
return (updatedPresence) => presence.update(updatedPresence);
}
|