DocuVieware Reference Guide
RegisterOnCommentEdited
Reference Guides > JavaScript API > Events > RegisterOnCommentEdited
 RegisterOnCommentEdited

This function allows you to trigger a function of your own when a comment has been edited.

RegisterOnCommentEdited: function (docuViewareID, callback)

Parameters

docuViewareID
The identifier for the DocuVieware™ instance.
callback
The function you want to execute on event.
The callback provides an argument having a prototype { id, pageNo }.
- id specifies the comment unique id that can be retrieved from the server side using the Guid property of the annotation class.
- pageNo is the page number of the comment that has been edited.

Return Value

1 if error.

Example of usage

This JavaScript makes sure the DocuVieware control is properly loaded and initialized and then subscribes to the event on load to display the corresponding comment id and page in the console.

function RegisterOnCommentEditedOnDocuViewareAPIReady() {
    if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) {
        DocuViewareAPI.RegisterOnCommentEdited("DocuVieware1", function (annot) { console.log(annot.id); });
    }
    else {
        setTimeout(function () { RegisterOnCommentEditedOnDocuViewareAPIReady() }, 10);
    }
}
document.addEventListener("DOMContentLoaded", function () {
    RegisterOnCommentEditedOnDocuViewareAPIReady();
}, false);