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){

View file

@ -22,7 +22,7 @@ export default class Constants {
* Used by 'PendingChangesUploader', which waits this amount of seconds to upload changes.
* (Note that pendingChanges might upload sooner if the popup is closed or similar)
*/
static updateTimeoutSec: number = 30;
static updateTimeoutSec: number = 180;
private static isRetina(): boolean {
if (Utils.runningFromConsole) {