couch-kit
    Preparing search index...

    Interface ActionRecorderControls<S, A>

    Return type of useActionRecorder.

    interface ActionRecorderControls<
        S extends IGameState = IGameState,
        A extends IAction = IAction,
    > {
        discardRecording: () => void;
        exportRecording: () => string | null;
        isRecording: boolean;
        recordAction: (action: A) => void;
        recordedCount: number;
        startRecording: (
            currentState: S,
            metadata?: Record<string, unknown>,
        ) => void;
        stopRecording: () => ActionRecording<S, A> | null;
    }

    Type Parameters

    Index
    discardRecording: () => void

    Discard the current recording

    exportRecording: () => string | null

    Export the current recording as JSON string

    isRecording: boolean

    Whether recording is currently active

    recordAction: (action: A) => void

    Record a single action (call this when dispatching)

    recordedCount: number

    Number of actions recorded so far

    startRecording: (currentState: S, metadata?: Record<string, unknown>) => void

    Start recording actions. Captures current state as initial state.

    stopRecording: () => ActionRecording<S, A> | null

    Stop recording and return the recording