Function setValueUndoCommand

  • Sets a value in the target object with undo/redo support. See uiconfig.js or threepipe UndoManagerPlugin for usage

    Type Parameters

    Parameters

    • um: undefined | JSUndoManager

      the undo manager to record the command in, if undefined, or not enabled the command will not be recorded but the value will still be set.

    • binding: [T1, keyof T1]

      a tuple of target object and key to set the value on

    • value: PrimitiveVal

      the value to set

    • props: SetValueUndoCommandProps<PrimitiveVal>

      properties for the undo command, including last, and lastValue(optional)

    • uid: any

      unique identifier for the command, used to merge commands

    • setValueCommandType: string

      command type for the setValue command

    • trackUndo: boolean = true

      whether to track the undo command or not, defaults to true

    • undoEditingWaitTime: number = 2000

      time in milliseconds to wait before considering the command final, defaults to 2000ms

    • saveBinding: boolean = false

      whether to save the binding in the command or not, defaults to false

    • OptionalonUndoRedo: (
          c: SetValueUndoCommand<
              PrimitiveVal,
              string,
              any,
              SetValueUndoCommandProps<PrimitiveVal>,
              any,
          >,
      ) => void

      optional callback function to be called on undo/redo of the command

    Returns {
        last: boolean;
        lastValue:
            | string
            | number
            | boolean
            | PrimitiveValObject
            | PrimitiveVal[]
            | T;
        undoable: boolean;
        value: PrimitiveVal;
    }

    an object containing the last value, the new value, the last value before the change, and whether the command is undoable or not.