code: function UndoManager (maxItems) {
      this.maxItems  = maxItems || 50;
      this.state = NORMAL_STATE;
      this.dontCompose = false;
      this.undoStack = [];
      this.redoStack = [];
    }
docs: Create a new UndoManager with an optional maximum history size.