Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active 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/967aa72be6ffaeb0cd20f840924f2ce7 to your computer and use it in GitHub Desktop.
Save bjoerntx/967aa72be6ffaeb0cd20f840924f2ce7 to your computer and use it in GitHub Desktop.
var _updating;
var _connection;
// connect to signalr hub
_connection = new signalR.HubConnectionBuilder().withUrl("/collabHub").build();
_connection.start();
_connection.on("ReceiveAnnotationSync", async function (annotationSync) {
// set flag to avoid infinite loops
_updating = true;
var currentJson = TXDocumentViewer.annotations.export();
if (currentJson != annotationSync.annotationJson)
TXDocumentViewer.annotations.load(annotationSync.annotationJson);
setTimeout(function () {
_updating = false;
}, 1000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment