Javascript: CommentCollection.getNextItem Method
Description
Gets the next comment in the text flow.
Syntax
<void> CommentCollection.getNextItem(<RequestCommentCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Receives the comment. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates CommentCollection.getNextItem in a practical document-editing workflow. It gets the next comment in the text flow.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textParts.getMainText(function(mainText) {
const comments = mainText.comments;
comments.getNextItem(
function(comment) {
if (!comment) {
console.warn("No commented text was returned.");
return;
}
console.log("get next item result:", comment);
},
onTxError
);
}, onTxError);