feat(web): alert after one hour of inactivity
This commit is contained in:
parent
6711a57e25
commit
cc13cb0962
8
main.js
8
main.js
|
@ -26,6 +26,7 @@ var codelanguages = ["xml", "js", "sql"];
|
|||
var currentnote = null;
|
||||
var fileindex = 0;
|
||||
var workerid = null;
|
||||
var inactivityid = null;
|
||||
var backup = "";
|
||||
var localdata = null;
|
||||
var saved = true;
|
||||
|
@ -1877,6 +1878,11 @@ function postpone()
|
|||
});
|
||||
}
|
||||
|
||||
function inactivityalert()
|
||||
{
|
||||
alert("Last save was one hour ago. Should you refresh?");
|
||||
}
|
||||
|
||||
async function save()
|
||||
{
|
||||
clearTimeout(workerid);
|
||||
|
@ -1949,6 +1955,8 @@ async function save()
|
|||
{
|
||||
console.log("...data saved on server");
|
||||
saved = true;
|
||||
clearTimeout(inactivityid);
|
||||
inactivityid = setTimeout(inactivityalert, 60 * 60 * 1000);
|
||||
})
|
||||
.catch(remotecallfailed)
|
||||
.finally(() =>
|
||||
|
|
Loading…
Reference in New Issue