comments, use 10 second polling
This commit is contained in:
parent
4673220624
commit
a58520341b
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
var poller = null;
|
var poller = null;
|
||||||
|
|
||||||
|
// refresh the UI every 10 seconds when not typing
|
||||||
let pollJob = function () {
|
let pollJob = function () {
|
||||||
|
|
||||||
poller = setInterval(function () {
|
poller = setInterval(function () {
|
||||||
@ -29,7 +30,7 @@ let pollJob = function () {
|
|||||||
$.get('/api/get', function (content) {
|
$.get('/api/get', function (content) {
|
||||||
$('textarea').val(content);
|
$('textarea').val(content);
|
||||||
});
|
});
|
||||||
}, 30000);
|
}, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
@ -46,7 +47,7 @@ $(function () {
|
|||||||
// start polling
|
// start polling
|
||||||
pollJob();
|
pollJob();
|
||||||
|
|
||||||
// save after half-second delay after typing
|
// save after a second delay after typing
|
||||||
$('textarea').keyup(function (e) {
|
$('textarea').keyup(function (e) {
|
||||||
|
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
@ -63,9 +64,6 @@ $(function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 20 second interval
|
|
||||||
// setInterval(saveContent, 60000);
|
|
||||||
|
|
||||||
// support tab key in textarea
|
// support tab key in textarea
|
||||||
$('textarea').keydown(function (e) {
|
$('textarea').keydown(function (e) {
|
||||||
if (e.keyCode === 9) { // tab was pressed
|
if (e.keyCode === 9) { // tab was pressed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user