Hiyve Components - v1.0.0
    Preparing search index...

    Return value of the usePolls hook.

    interface PollState {
        closePoll: (pollId: string) => void;
        createPoll: (
            question: string,
            type: "multiple-choice" | "yes-no",
            options?: string[],
        ) => void;
        handleDataMessage: (data: Record<string, unknown>) => void;
        polls: Poll[];
        vote: (pollId: string, optionId: string) => void;
    }
    Index

    Properties

    closePoll: (pollId: string) => void

    Close a poll and broadcast the closure via data message.

    createPoll: (
        question: string,
        type: "multiple-choice" | "yes-no",
        options?: string[],
    ) => void

    Create a new poll and broadcast it via data message.

    handleDataMessage: (data: Record<string, unknown>) => void

    Process an incoming poll data message from a remote user.

    polls: Poll[]

    All polls (both active and closed).

    vote: (pollId: string, optionId: string) => void

    Cast a vote on a poll option and broadcast it via data message.