DS Server

RequestCommentsCallback Function

Function|Introduced in 30.0

Description

Callback function for requests retrieving an array of CommentedText objects.

Syntax

function(<CommentedText[]> comments)

Examples

The following example demonstrates RequestCommentsCallback in a practical document-editing workflow. Callback function for requests retrieving an array of CommentedText objects.

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

function requestCommentsCallback(comments) {
    console.log("comments:", comments);
}

TXTextControl.textParts.getMainText(function(mainText) {
    const comments = mainText.comments;
    comments.getItem(function(commentedText) {
        if (!commentedText) {
            console.warn("No commented text is available at the current input position.");
            return;
        }
    
        commentedText.getReplies(requestCommentsCallback, onTxError);
    }, onTxError);
}, onTxError);