frontend
    Preparing search index...

    Interface TrickGameBaseResult<TState, TArgs, TConfig, THint>

    Return value of useTrickGameBase.

    interface TrickGameBaseResult<
        TState,
        TArgs extends unknown[],
        TConfig extends object,
        THint,
    > {
        clearSelection: () => void;
        config: TConfig;
        error: string | null;
        exec: (...args: TArgs) => Promise<void>;
        handleConfigChange: (key: NumberKeys<TConfig>, value: string) => void;
        handleHint: () => Promise<void>;
        handleNextRound: () => void;
        handleNextTrick: () => void;
        handlePlay: () => void;
        handleToggle: (key: BooleanKeys<TConfig>, value: boolean) => void;
        hint: THint | null;
        hintError: string | null;
        hintLoading: boolean;
        loading: boolean;
        retry: () => Promise<void>;
        selectedCardIndices: number[];
        state: TState | null;
        toggleCard: (idx: number) => void;
    }

    Type Parameters

    • TState

      The game state type returned by the API.

    • TArgs extends unknown[]

      The tuple of argument types accepted by the API exec function.

    • TConfig extends object

      The game configuration type.

    • THint

      The hint type.

    Index

    Properties

    clearSelection: () => void

    Clears all selected cards.

    config: TConfig

    Current game configuration.

    error: string | null

    Error message from the last failed API call, or null.

    exec: (...args: TArgs) => Promise<void>

    Raw exec function to dispatch arbitrary API commands.

    handleConfigChange: (key: NumberKeys<TConfig>, value: string) => void

    Updates a numeric config field from a string value.

    handleHint: () => Promise<void>

    Fetches a hint from the server.

    handleNextRound: () => void

    Advances to the next round.

    handleNextTrick: () => void

    Advances to the next trick.

    handlePlay: () => void

    Plays the single currently-selected card. No-op if zero or multiple cards are selected.

    handleToggle: (key: BooleanKeys<TConfig>, value: boolean) => void

    Toggles a boolean config field.

    hint: THint | null

    The latest hint returned by the hint command, or null.

    hintError: string | null

    Error message from the last failed hint request, or null.

    hintLoading: boolean

    True while a hint request is in flight.

    loading: boolean

    True while an API call is in flight.

    retry: () => Promise<void>

    Retries the last failed API call.

    selectedCardIndices: number[]

    Indices of currently selected cards.

    state: TState | null

    Current game state, or null before the first successful API call.

    toggleCard: (idx: number) => void

    Toggles selection of the card at the given index.