Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created June 8, 2021 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/a90fecbe284c11074b36431ee655dd02 to your computer and use it in GitHub Desktop.
Save bjoerntx/a90fecbe284c11074b36431ee655dd02 to your computer and use it in GitHub Desktop.
window.addEventListener("documentViewerLoaded", function () {
TXDocumentViewer.addEventListener("annotationsChanged", updateAnnotations);
});
function updateAnnotations() {
if (_updating === true)
return;
var jsonAnnotations = TXDocumentViewer.annotations.export();
// create sync object
var collaborationSyncObject = {
User: "Test",
AnnotationJson: jsonAnnotations
};
// call signalr hub with sync object
_connection.invoke("SetAnnotationSync",
collaborationSyncObject).catch(function (err) {
return console.error(err.toString());
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment