@dxos/app-framework - v0.16.0
    Preparing search index...

    Interface HistoryTracker

    HistoryTracker interface - tracks operation history and provides undo and redo. Every method taking an optional scope acts on the latest entry in that scope, or on the latest entry across the whole app when the scope is omitted.

    interface HistoryTracker {
        applied: PubSub<HistoryEvent>;
        canRedo: (scope?: string) => boolean;
        canUndo: (scope?: string) => boolean;
        redo: (scope?: string) => Effect<HistoryResult, Error>;
        redoPromise: (
            scope?: string,
        ) => Promise<{ error?: Error; result?: HistoryResult }>;
        transaction: <A, E, R>(
            label:
                | string
                | [
                    string,
                    {
                        count?: number;
                        defaultValue?: string;
                        ns: string
                        | readonly string[];
                    },
                ],
            effect: Effect<A, E, R>,
            options?: TransactionOptions,
        ) => Effect<A, E, R>;
        undo: (scope?: string) => Effect<HistoryResult, Error>;
        undoable: PubSub<UndoableEvent>;
        undoPromise: (
            scope?: string,
        ) => Promise<{ error?: Error; result?: HistoryResult }>;
    }
    Index

    Properties

    applied: PubSub<HistoryEvent>

    Stream of undo and redo applications.

    canRedo: (scope?: string) => boolean
    canUndo: (scope?: string) => boolean
    redo: (scope?: string) => Effect<HistoryResult, Error>
    redoPromise: (
        scope?: string,
    ) => Promise<{ error?: Error; result?: HistoryResult }>
    transaction: <A, E, R>(
        label:
            | string
            | [
                string,
                { count?: number; defaultValue?: string; ns: string
                | readonly string[] },
            ],
        effect: Effect<A, E, R>,
        options?: TransactionOptions,
    ) => Effect<A, E, R>

    Runs the effect and records every undoable invocation it makes as one entry labelled label. Nested transactions join the outermost one.

    undo: (scope?: string) => Effect<HistoryResult, Error>
    undoable: PubSub<UndoableEvent>

    Stream of undoable actions, published as they are recorded.

    undoPromise: (
        scope?: string,
    ) => Promise<{ error?: Error; result?: HistoryResult }>