Upload data less aggressively

This commit is contained in:
Pieter Vander Vennet 2021-07-01 22:04:46 +02:00
parent b7798a470c
commit 0ef73c1c74
2 changed files with 1 additions and 33 deletions

View file

@ -21,38 +21,6 @@ export default class PendingChangesUploader{
});
selectedFeature
.stabilized(10000)
.addCallback(feature => {
if(feature === undefined){
// The popup got closed - we flush
changes.flushChanges("Flushing changes due to popup closed");
}
});
document.addEventListener('mouseout', e => {
// @ts-ignore
if (!e.toElement && !e.relatedTarget) {
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){
if(changes.pending.data.length == 0){