# UndoCommandSupport

## Content

# Interface: UndoCommandSupport

Interface for undo commands.

## Example

```javascript
// The UndoCommandSupport interface implementation example.
class CustomUndoCommand implements UndoCommandSupport {
  name: "CustomUndoCommand",
  execute: function(viewer) {
    return new Promise((resolve) => {
      // Put your action code here
      resolve();
    })
  },
  undo: function(viewer) {
    return new Promise((resolve) => {
      // Put your undo action here
      resolve();
    })
  }
}
```

## Properties

### name

```ts
name: string;
```

Optional. The unique name of the command. Used by the undo.skipCommands option setting.

## Methods

### execute()

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

Action implementation.

#### Parameters

##### viewer

[`ImageViewerAPI`](ImageViewerAPI)

#### Returns

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

***

### undo()

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

Undo action implementation.

#### Parameters

##### viewer

[`ImageViewerAPI`](ImageViewerAPI)

#### Returns

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