TX Text Control .NET Server

Javascript: DocumentTargetCollection.clear Method

Method|Introduced in 28.0

Description

Removes all document targets from the collection.

Syntax

<void> DocumentTargetCollection.clear([<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Optional. Is called when the operation completed.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates DocumentTargetCollection.clear in a practical document-editing workflow. It removes all document targets from the collection.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const documentTargets = mainText.documentTargets;
    documentTargets.clear(
        function() {
            console.log("clear completed.");
        },
        onTxError
    );
}, onTxError);