feat(web): alert after one hour of inactivity

This commit is contained in:
quenousimporte 2023-09-15 13:31:44 +02:00
parent 6711a57e25
commit cc13cb0962
1 changed files with 8 additions and 0 deletions

View File

@ -26,6 +26,7 @@ var codelanguages = ["xml", "js", "sql"];
var currentnote = null; var currentnote = null;
var fileindex = 0; var fileindex = 0;
var workerid = null; var workerid = null;
var inactivityid = null;
var backup = ""; var backup = "";
var localdata = null; var localdata = null;
var saved = true; var saved = true;
@ -1877,6 +1878,11 @@ function postpone()
}); });
} }
function inactivityalert()
{
alert("Last save was one hour ago. Should you refresh?");
}
async function save() async function save()
{ {
clearTimeout(workerid); clearTimeout(workerid);
@ -1949,6 +1955,8 @@ async function save()
{ {
console.log("...data saved on server"); console.log("...data saved on server");
saved = true; saved = true;
clearTimeout(inactivityid);
inactivityid = setTimeout(inactivityalert, 60 * 60 * 1000);
}) })
.catch(remotecallfailed) .catch(remotecallfailed)
.finally(() => .finally(() =>