remove polling, for now

This commit is contained in:
Ryan Peters 2023-01-11 12:40:46 -05:00
parent e5f1b9e936
commit 1ee15a8ed3

View File

@ -20,19 +20,6 @@
});
};
var poller = null;
// refresh the UI every 10 seconds when not typing
let pollJob = function () {
poller = setInterval(function () {
$.get('/api/get', function (content) {
$('textarea').val(content);
});
}, 10000);
}
$(function () {
// set dark mode
@ -44,14 +31,10 @@ $(function () {
let ignoredKeyCodes = [17, 18, 20, 27, 37, 38, 39, 40, 91];
// start polling
pollJob();
// save after a second delay after typing
$('textarea').keyup(function (e) {
clearTimeout(timer);
clearInterval(poller);
// only set timer if key isn't ignored
if (!ignoredKeyCodes.includes(e.keyCode)) {
@ -59,8 +42,6 @@ $(function () {
timer = setTimeout(function () {
saveContent();
}, 1000);
pollJob();
}
});