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
|
@ -37,6 +37,22 @@ export default class PendingChangesUploader{
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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){
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Utils } from "../Utils";
|
||||||
|
|
||||||
export default class Constants {
|
export default class Constants {
|
||||||
|
|
||||||
public static vNumber = "0.5.2b";
|
public static vNumber = "0.5.2c";
|
||||||
|
|
||||||
// The user journey states thresholds when a new feature gets unlocked
|
// The user journey states thresholds when a new feature gets unlocked
|
||||||
public static userJourney = {
|
public static userJourney = {
|
||||||
|
|
Loading…
Reference in a new issue