comments, use 10 second polling

This commit is contained in:
Ryan Peters 2023-01-11 10:57:23 -05:00
parent 4673220624
commit a58520341b

View File

@ -22,6 +22,7 @@
var poller = null;
// refresh the UI every 10 seconds when not typing
let pollJob = function () {
poller = setInterval(function () {
@ -29,7 +30,7 @@ let pollJob = function () {
$.get('/api/get', function (content) {
$('textarea').val(content);
});
}, 30000);
}, 10000);
}
$(function () {
@ -46,7 +47,7 @@ $(function () {
// start polling
pollJob();
// save after half-second delay after typing
// save after a second delay after typing
$('textarea').keyup(function (e) {
clearTimeout(timer);
@ -63,9 +64,6 @@ $(function () {
}
});
// 20 second interval
// setInterval(saveContent, 60000);
// support tab key in textarea
$('textarea').keydown(function (e) {
if (e.keyCode === 9) { // tab was pressed