# Javascript: TrackedChange.save Method

> Saves the tracked change in a certain format and sends the result back asynchronously by calling a given callback function.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: TrackedChange.save Method
- **610 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/trackedchange/save-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/trackedchange/save-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/trackedchange/save-method/llms-full.txt

---

### Description

Saves the tracked change in a certain format and sends the result back asynchronously by calling a given callback function.

### Syntax

```javascript
<void> TrackedChange.save(<StreamType> streamType, <SaveDocumentCallback> callback, [<SaveSettings> saveSettings], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| streamType | Specifies one of the StreamType values. |
| callback | Receives the tracked change's data in a certain format including additional information. |
| saveSettings | Optional. Specifies additional settings for saving. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `TrackedChange.save` in a practical document-editing workflow. It saves the tracked change in a certain format and sends the result back asynchronously by calling a given callback function.

```javascript
function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.textParts.getMainText(function(mainText) {
    const trackedChanges = mainText.trackedChanges;
    trackedChanges.getItem(function(trackedChange) {
        if (!trackedChange) {
            console.warn("No tracked change is available at the current input position.");
            return;
        }
    
        trackedChange.save(
            TXTextControl.StreamType.HTMLFormat,
            function(result) {
                if (!result) {
                    console.warn("No save document result was returned.");
                    return;
                }
                
                console.log("save result:", result);
            },
            { creatorApplication: "Document Editor sample" },
            onTxError
        );
    }, onTxError);
}, onTxError);
```

---

## Nearby

- **Previous:** [Javascript: TrackedChange.getUserName Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/trackedchange/getusername-method/llms-full.txt)
- **Next:** [Javascript: TrackedChange.setActive Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/trackedchange/setactive-method/llms-full.txt)
