summaryrefslogtreecommitdiffhomepage
path: root/html
diff options
context:
space:
mode:
Diffstat (limited to 'html')
-rw-r--r--html/whiteboard.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/html/whiteboard.js b/html/whiteboard.js
index a6dc089..b11dc96 100644
--- a/html/whiteboard.js
+++ b/html/whiteboard.js
@@ -4,6 +4,7 @@ function init() {
}
var revision;
+var modify_in_progress = 0;
var baseline = ""; // data contents relating to revision, acknowledged by server
var baseline_candidate = ""; // will become baseline, after ack by server
@@ -51,7 +52,7 @@ function on_getfile(data, rev, pos)
function on_getdiff(diff, rev, pos)
{
if (rev != revision + 1)
- alert("Revision skipped: " + rev + " after " + revision);
+ console.log("Revision skipped on diff receive: " + rev + " after " + revision);
var board = document.getElementById("board");
@@ -95,8 +96,12 @@ function on_version(version)
function on_modify_ack(rev)
{
+ if (rev != revision + 1)
+ console.log("Revision skipped on published local change: " + rev + " after " + revision);
+
revision = rev;
baseline = baseline_candidate;
+ modify_in_progress = 0;
}
function on_message(e) {
@@ -228,6 +233,13 @@ function redirect_to_new_page()
// local change done
function on_input()
{
+ if (modify_in_progress == 1) {
+ console.log("Deferring on_input handler by 100ms");
+ setTimeout(function(){on_input();}, 100); // re-try after 100ms
+ return;
+ }
+ modify_in_progress = 1;
+
var parser = new DOMParser();
var xmlDocument = parser.parseFromString("<request></request>", "text/xml");
@@ -243,6 +255,11 @@ function on_input()
baseline_candidate = document.getElementById("board").value;
+ if (baseline == baseline_candidate) {
+ modify_in_progress = 0;
+ return;
+ }
+
var revisionElement = xmlDocument.createElement("baserev");
revisionElement.appendChild(document.createTextNode(revision));
requestElement.appendChild(revisionElement);