$(document).on('documentLoaded', function() {
var annotManager = readerControl.docViewer.getAnnotationManager();
annotManager.on('annotationChanged', function(e, annots, action) {
if (!e.imported && action === 'add') {
annots.forEach(function(annot) {
if (!annot.InReplyTo) {
console.log('send email to some users');
}
});
}
});
annotManager.on('addReply', function(e, reply, parent, root) {
console.log('send email to ' + root.Author);
root.getReplies().forEach(function(reply) {
console.log('and to ' + reply.Author);
});
});
});