1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Extended uhoh timer

Former-commit-id: 01baaecbf19772bdb8feebd385dce23691407c6d [formerly 394cc74f14836ed3bfbba3f4538f5704d4ad766e] [formerly e9ee089494713194286c4c5aacc4af9ab39d9d98 [formerly 3c8f76e520deaef9e58baa9b4fe29fcd59ad1458 [formerly 1fba482800]]]
Former-commit-id: 9ef631e359496c6a09401ad2f78afea7ad7e6d48 [formerly 71e21641898cb9e0e4a59dbf62ba31c796d98efe]
Former-commit-id: b3a11c2c9ec307b510bb10de74a7f1f3055c9f1c
Former-commit-id: 8b874f068b
This commit is contained in:
Zack Scholl 2016-06-29 20:11:20 -04:00
parent 7709b6317d
commit 64d589df44

View File

@ -6,7 +6,7 @@ $(document).ready(function() {
var updateInterval; var updateInterval;
var uhohTimer; var uhohTimer;
var doneTypingInterval = 500; //time in ms, 5 second for example var doneTypingInterval = 500; //time in ms, 5 second for example
var pollToGetNewestCopyInterval = 20000; var pollToGetNewestCopyInterval = 30000;
//on keyup, start the countdown //on keyup, start the countdown
$('#emit').keyup(function() { $('#emit').keyup(function() {
clearTimeout(typingTimer); clearTimeout(typingTimer);
@ -27,7 +27,7 @@ $(document).ready(function() {
function doneTyping() { function doneTyping() {
payload = JSON.stringify({ TextData: currentText(), Title: title_name, UpdateServer: true, UpdateClient: false }) payload = JSON.stringify({ TextData: currentText(), Title: title_name, UpdateServer: true, UpdateClient: false })
send(payload) send(payload)
uhohTimer = setTimeout(uhoh, 3000); uhohTimer = setTimeout(uhoh, 30000);
$('#saveInfo').removeClass().addClass("glyphicon glyphicon-floppy-open"); $('#saveInfo').removeClass().addClass("glyphicon glyphicon-floppy-open");
console.log("Done typing") console.log("Done typing")
updateInterval = setInterval(updateText, pollToGetNewestCopyInterval); updateInterval = setInterval(updateText, pollToGetNewestCopyInterval);
@ -54,6 +54,7 @@ $(document).ready(function() {
console.log("Getting server's latest copy") console.log("Getting server's latest copy")
payload = JSON.stringify({ TextData: currentText(), Title: title_name, UpdateServer: false, UpdateClient: true }) payload = JSON.stringify({ TextData: currentText(), Title: title_name, UpdateServer: false, UpdateClient: true })
send(payload) send(payload)
clearTimeout(uhohTimer);
} }
// websockets // websockets