UNPKG

@tldraw/editor

Version:

tldraw infinite canvas SDK (editor).

18 lines (17 loc) 441 B
import { useValue } from "@tldraw/state-react"; import { useEditor } from "./useEditor.mjs"; function usePresence(userId) { const editor = useEditor(); const latestPresence = useValue( `latestPresence:${userId}`, () => { return editor.getCollaborators().find((c) => c.userId === userId); }, [editor, userId] ); return latestPresence ?? null; } export { usePresence }; //# sourceMappingURL=usePresence.mjs.map