Class JSUndoManager

Main class

Hierarchy

  • JSUndoManager

Constructors

Properties

limit: number
options: JSUndoManagerOptions = ...
predefined: Record<string, ((data) => JSUndoManagerCommand1)> = {}
sp: number
stack: JSUndoManagerCommand[]

Methods

  • Parameters

    • command1: JSUndoManagerCommand1 | JSUndoManagerCommand2

    Returns JSUndoManagerCommand1

  • Parameters

    • command: JSUndoManagerCommand

    Returns void

  • Bind 'undo' and 'redo' actions to 'Ctrl/Cmd+Z', 'Ctrl+Y' & 'Ctrl/Cmd+Shift+Z' hot keys. It is a basic implementation for quick testing and should be replaced with custom event handlers for more flexible processing.

    Returns JSUndoManager

  • Check whether redoing command is possible

    Returns boolean

  • Check whether undoing previous command is possible

    Returns boolean

  • Execute function and record it with its opposite "undo" function

    Parameters

    • command1: JSUndoManagerCommand

      either an object with "redo" and "undo" functions

    Returns JSUndoManager

  • Get number of commands in memory stack

    Returns number

  • Check whether the commands stack is empty

    Returns boolean

  • Check whether the commands stack size reaches its limit

    Returns boolean

  • Parameters

    • msg: string
    • Rest ...args: any[]

    Returns void

  • Remember executed command containing "redo" and "undo" functions

    Parameters

    • command: JSUndoManagerCommand

      either an object with "redo" and "undo" functions

    Returns JSUndoManager

Generated using TypeDoc