# GC.Spread.Commands.UndoManager

## Content

# Class: UndoManager

[Spread](../modules/GC.Spread).[Commands](../modules/GC.Spread.Commands).UndoManager

## Table of contents

### Constructors

- [constructor](GC.Spread.Commands.UndoManager#constructor)

### Methods

- [canRedo](GC.Spread.Commands.UndoManager#canredo)
- [canUndo](GC.Spread.Commands.UndoManager#canundo)
- [clear](GC.Spread.Commands.UndoManager#clear)
- [getRedoStack](GC.Spread.Commands.UndoManager#getredostack)
- [getUndoStack](GC.Spread.Commands.UndoManager#getundostack)
- [maxSize](GC.Spread.Commands.UndoManager#maxsize)
- [redo](GC.Spread.Commands.UndoManager#redo)
- [undo](GC.Spread.Commands.UndoManager#undo)

## Constructors

### <a id="constructor" name="constructor"></a> constructor

• **new UndoManager**()

Represents the undo manager.

## Methods

### <a id="canredo" name="canredo"></a> canRedo

▸ **canRedo**(): `boolean`

Gets whether the redo operation is allowed.

#### Returns

`boolean`

`true` if the redo operation is allowed; otherwise, `false`.

___

### <a id="canundo" name="canundo"></a> canUndo

▸ **canUndo**(): `boolean`

Gets whether the undo operation is allowed.

#### Returns

`boolean`

`true` if the undo operation is allowed; otherwise, `false`.

___

### <a id="clear" name="clear"></a> clear

▸ **clear**(): `void`

Clears all of the undo stack and the redo stack.

#### Returns

`void`

___

### <a id="getredostack" name="getredostack"></a> getRedoStack

▸ **getRedoStack**(): `any`[]

Get the redo stack.

#### Returns

`any`[]

It returns an object. This  must include sheetName and cmd. the type of sheetName and cmd both is string.

___

### <a id="getundostack" name="getundostack"></a> getUndoStack

▸ **getUndoStack**(): `any`[]

Get the undo stack.

#### Returns

`any`[]

It returns is an object. This object must include sheetName and cmd. the type of sheetName and cmd both is string.

___

### <a id="maxsize" name="maxsize"></a> maxSize

▸ **maxSize**(`value?`): `any`

Gets or sets the the undo/redo stack max size.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `number` | this value should be greater or equal to 0. |

#### Returns

`any`

If no value is set. return the max size of undo/redo stack. otherwise return UndoManager.

___

### <a id="redo" name="redo"></a> redo

▸ **redo**(): `boolean`

Redoes the last command.

#### Returns

`boolean`

`true` if the redo operation is successful; otherwise, `false`.

___

### <a id="undo" name="undo"></a> undo

▸ **undo**(): `boolean`

Undoes the last command.

#### Returns

`boolean`

`true` if the undo operation is successful; otherwise, `false`.
