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

    Interface UndoMapping<Op, Inv>

    Undo mapping that links a forward operation to its inverse. Type parameters ensure deriveContext has correctly typed arguments.

    interface UndoMapping<
        Op extends
            Operation.Definition<any, any> = Operation.Definition<any, any>,
        Inv extends Operation.Definition<any, any> = Operation.Definition<any, any>,
    > {
        deriveContext: (
            input: InputOf<Op>,
            output: OutputOf<Op>,
        ) => undefined | InputOf<Inv>;
        inverse: Inv;
        message?: MessageProvider<Op>;
        operation: Op;
    }

    Type Parameters

    • Op extends Operation.Definition<any, any> = Operation.Definition<any, any>

      The forward operation definition type.

    • Inv extends Operation.Definition<any, any> = Operation.Definition<any, any>

      The inverse operation definition type.

    Index

    Properties

    deriveContext: (
        input: InputOf<Op>,
        output: OutputOf<Op>,
    ) => undefined | InputOf<Inv>

    Derives the input for the inverse operation from the forward operation's input and output.

    Type declaration

      • (input: InputOf<Op>, output: OutputOf<Op>): undefined | InputOf<Inv>
      • Parameters

        • input: InputOf<Op>

          The input that was passed to the forward operation.

        • output: OutputOf<Op>

          The output that was returned by the forward operation.

        Returns undefined | InputOf<Inv>

        The input to pass to the inverse operation, or undefined to indicate the operation is not undoable.

    inverse: Inv

    The inverse operation to invoke for undo.

    message?: MessageProvider<Op>

    Optional message to show in the undo toast. Can be a static Label or a function that derives the message from input/output.

    operation: Op

    The forward operation.