Javascript: EmbeddedFileCollection.removeElementAt Method
Description
Removes the embedded file at the given index.
Syntax
<void> EmbeddedFileCollection.removeElementAt(<number> index, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| index | The index in the collection of the embedded file to remove. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates EmbeddedFileCollection.removeElementAt in a practical document-editing workflow. It removes the embedded file at the given index.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textParts.getMainText(function(mainText) {
const embeddedFiles = mainText.embeddedFiles;
embeddedFiles.removeElementAt(
0,
function() {
console.log("remove element at completed.");
},
onTxError
);
}, onTxError);