Last active
June 8, 2021 10:03
-
-
Save bjoerntx/967aa72be6ffaeb0cd20f840924f2ce7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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