forked from MapComplete/MapComplete
Upload data less aggressively
This commit is contained in:
parent
b7798a470c
commit
0ef73c1c74
2 changed files with 1 additions and 33 deletions
|
@ -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){
|
window.onbeforeunload = function(e){
|
||||||
|
|
||||||
if(changes.pending.data.length == 0){
|
if(changes.pending.data.length == 0){
|
||||||
|
|
|
@ -22,7 +22,7 @@ export default class Constants {
|
||||||
* Used by 'PendingChangesUploader', which waits this amount of seconds to upload changes.
|
* 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)
|
* (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 {
|
private static isRetina(): boolean {
|
||||||
if (Utils.runningFromConsole) {
|
if (Utils.runningFromConsole) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue