Skip to content

Commit

Permalink
feat(gDriveSync): save data before closing the page
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesjo committed Mar 9, 2018
1 parent 19da8f2 commit ae7a14a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app-src/scripts/main/global-services/app-storage-s.js
Expand Up @@ -31,6 +31,7 @@

this.getCurrentLs();
this.setupPollingForSavingCurrentState();
this.initUnloadSave();

// this is really nice for debugging but we don't want to use it for
// actual saving the data as it is costly to run
Expand All @@ -39,6 +40,12 @@
//}, 5);
}

initUnloadSave() {
window.onbeforeunload = window.onunload = () => {
this.saveToLs();
};
}

initBackupsIfEnabled() {
if (!this.IS_ELECTRON ||
!this.$rootScope.r.config.automaticBackups ||
Expand Down

0 comments on commit ae7a14a

Please sign in to comment.