From 64d589df44da3da943d6e378d6489ccf605e7c97 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Wed, 29 Jun 2016 20:11:20 -0400 Subject: [PATCH] Extended uhoh timer Former-commit-id: 01baaecbf19772bdb8feebd385dce23691407c6d [formerly 394cc74f14836ed3bfbba3f4538f5704d4ad766e] [formerly e9ee089494713194286c4c5aacc4af9ab39d9d98 [formerly 3c8f76e520deaef9e58baa9b4fe29fcd59ad1458 [formerly 1fba482800a0ced5accdb4cb377642432dbf6f15]]] Former-commit-id: 9ef631e359496c6a09401ad2f78afea7ad7e6d48 [formerly 71e21641898cb9e0e4a59dbf62ba31c796d98efe] Former-commit-id: b3a11c2c9ec307b510bb10de74a7f1f3055c9f1c Former-commit-id: 8b874f068b47af632ed1659a066c495f42dc93d9 --- static/js/websockets.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/js/websockets.js b/static/js/websockets.js index 9c6d6f6..3c6950e 100644 --- a/static/js/websockets.js +++ b/static/js/websockets.js @@ -6,7 +6,7 @@ $(document).ready(function() { var updateInterval; var uhohTimer; var doneTypingInterval = 500; //time in ms, 5 second for example - var pollToGetNewestCopyInterval = 20000; + var pollToGetNewestCopyInterval = 30000; //on keyup, start the countdown $('#emit').keyup(function() { clearTimeout(typingTimer); @@ -27,7 +27,7 @@ $(document).ready(function() { function doneTyping() { payload = JSON.stringify({ TextData: currentText(), Title: title_name, UpdateServer: true, UpdateClient: false }) send(payload) - uhohTimer = setTimeout(uhoh, 3000); + uhohTimer = setTimeout(uhoh, 30000); $('#saveInfo').removeClass().addClass("glyphicon glyphicon-floppy-open"); console.log("Done typing") updateInterval = setInterval(updateText, pollToGetNewestCopyInterval); @@ -54,6 +54,7 @@ $(document).ready(function() { console.log("Getting server's latest copy") payload = JSON.stringify({ TextData: currentText(), Title: title_name, UpdateServer: false, UpdateClient: true }) send(payload) + clearTimeout(uhohTimer); } // websockets