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

Extended uhoh timer

This commit is contained in:
Zack Scholl 2016-06-29 20:11:20 -04:00
parent d28a80b08f
commit 1fba482800

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