forked from MapComplete/MapComplete
Better saving of features when focus is lost, esp on mobile browsers
This commit is contained in:
parent
a0b909e8a6
commit
3586b8eef2
2 changed files with 17 additions and 1 deletions
|
@ -36,6 +36,22 @@ export default class PendingChangesUploader{
|
|||
changes.flushChanges("Flushing changes due to focus lost");
|
||||
}
|
||||
});
|
||||
|
||||
document.onfocus = () => {
|
||||
changes.flushChanges("OnFocus")
|
||||
}
|
||||
|
||||
document.onblur = () => {
|
||||
changes.flushChanges("OnFocus")
|
||||
}
|
||||
try{
|
||||
document.addEventListener("visibilitychange", () => {
|
||||
changes.flushChanges("Visibility change")
|
||||
}, false);
|
||||
}catch(e){
|
||||
console.warn("Could not register visibility change listener", e)
|
||||
}
|
||||
|
||||
|
||||
window.onbeforeunload = function(e){
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue