From 1ee15a8ed32914264a65fe92e1afe965651a0398 Mon Sep 17 00:00:00 2001 From: Ryan Peters Date: Wed, 11 Jan 2023 12:40:46 -0500 Subject: [PATCH] remove polling, for now --- wwwroot/js/site.js | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/wwwroot/js/site.js b/wwwroot/js/site.js index c52a6df..1878157 100644 --- a/wwwroot/js/site.js +++ b/wwwroot/js/site.js @@ -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(); } });