constructor() {
    /** @private */
    this._undos = [];
    /** @private */
    this._redos = [];
    /** @private */
    this._isUndoing = false;
    /** @private */
    this._isRedoing = false;
  }
UndoManager is a general-purpose recorder of operations for undo and redo.

Registering an undo action is done by specifying the changed object, along
with a method to invoke to revert its state and the arguments for that
method. When performing undo an UndoManager saves the operations reverted so
that you can redo the undos.