@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
22 lines (21 loc) • 888 B
TypeScript
export interface UseTypingIndicatorProps {
conversationId: string;
}
export interface UseTypingIndicatorValues {
/** userIds of people currently typing (current user is excluded) */
typingUsers: string[];
/** Call on each keystroke — internally throttles the keep-alive emit to every 2 s */
startTyping: () => void;
/** Call on send, input clear, or blur */
stopTyping: () => void;
}
/**
* Manages the typing indicator for a conversation.
*
* Sender side protocol (§6.5 of design):
* 1. On first keystroke after idle: emit `typing:start` immediately.
* 2. Re-emit `typing:start` every 2 s as a keep-alive while typing continues.
* 3. On send / blur / input clear: cancel keep-alive, emit `typing:stop`.
*/
declare function useTypingIndicator({ conversationId, }: UseTypingIndicatorProps): UseTypingIndicatorValues;
export default useTypingIndicator;