# UndoStorage

## Content

# Interface: UndoStorage

Command based undo state storage.

## Properties

### hasRedo

```ts
readonly hasRedo: boolean;
```

Gets a value indicating whether the undo storage can redo changes.

***

### hasUndo

```ts
readonly hasUndo: boolean;
```

Gets a value indicating whether the undo storage can undo changes.

***

### undoCount

```ts
readonly undoCount: number;
```

Gets total undo levels count.

***

### undoIndex

```ts
readonly undoIndex: number;
```

Gets current undo level index.

***

### undoInProgress

```ts
readonly undoInProgress: boolean;
```

Gets a flag indicating whether an undo/redo or execute operation is in progress.

## Methods

### applyOptions()

```ts
applyOptions(options): void;
```

Apply undo storage options.

#### Parameters

##### options

[`ViewerOptions`](ViewerOptions)

#### Returns

`void`

***

### clear()

```ts
clear(): void;
```

Clear undo storage.

#### Returns

`void`

***

### dispose()

```ts
dispose(): void;
```

Dispose undo storage.

#### Returns

`void`

***

### execute()

```ts
execute(command): Promise<void>;
```

Execute a new command.

#### Parameters

##### command

[`UndoCommandSupport`](UndoCommandSupport)

Instance of a command.

#### Returns

`Promise`&lt;`void`&gt;

***

### isCommandSupported()

```ts
isCommandSupported(command): boolean;
```

Gets a value indicating whether the command specified in the command parameter is supported.

#### Parameters

##### command

[`UndoCommandSupport`](UndoCommandSupport)

Instance of a command.

#### Returns

`boolean`

***

### onCommandExecuted()

```ts
onCommandExecuted(command): void;
```

Called after command action has been executed.

#### Parameters

##### command

[`UndoCommandSupport`](UndoCommandSupport)

Instance of a command.

#### Returns

`void`

***

### redo()

```ts
redo(): Promise<void>;
```

Redo next action.

#### Returns

`Promise`&lt;`void`&gt;

***

### undo()

```ts
undo(): Promise<void>;
```

Undo last action.

#### Returns

`Promise`&lt;`void`&gt;
