Skip to content
This repository has been archived by the owner on Jun 20, 2022. It is now read-only.

Commit

Permalink
Download launch backup on first blur, web-3.0.4 with performance opti…
Browse files Browse the repository at this point in the history
…mizations, 3.0.4-beta2
  • Loading branch information
moughxyz committed Jan 31, 2019
1 parent 1112da9 commit e9c247f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
3 changes: 2 additions & 1 deletion app/index.js
Expand Up @@ -55,7 +55,7 @@ function createWindow () {
'y': winState.y,
'width': winState.width,
'height': winState.height,
'minWidth': 600,
'minWidth': 300,
'minHeight': 400,
show: false,
icon: iconLocation,
Expand All @@ -80,6 +80,7 @@ function createWindow () {

win.on('blur', (event) => {
win.webContents.send("window-blurred", null);
archiveManager.applicationDidBlur();
})

win.on('focus', (event) => {
Expand Down
11 changes: 10 additions & 1 deletion app/javascripts/main/archiveManager.js
Expand Up @@ -21,6 +21,13 @@ class ArchiveManager {
this.backupsDisabled = store.get("backupsDisabled");
}

applicationDidBlur() {
if(this.needsBackup) {
this.needsBackup = false;
this.performBackup();
}
}

defaultLocation() {
return path.join(app.getPath('home'), "Standard Notes Backups");
}
Expand Down Expand Up @@ -87,7 +94,9 @@ class ArchiveManager {
clearInterval(this.interval);
}

this.performBackup();
// Instead of performing a backup on app launch,
// which drastically slows down performance, wait until window blurs
this.needsBackup = true;

let hoursInterval = 12; // Every X hours
let seconds = hoursInterval * 60 * 60;
Expand Down
8 changes: 4 additions & 4 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/package.json
Expand Up @@ -3,7 +3,7 @@
"productName": "Standard Notes",
"description": "A simple and private place for your notes, thoughts, and life's work.",
"author": "Standard Notes <hello@standardnotes.org>",
"version": "3.0.3",
"version": "3.0.4-beta2",
"main": "./dist/index.js",
"dependencies": {
"adm-zip": "^0.4.7",
Expand All @@ -18,6 +18,6 @@
"request": "^2.83.0",
"semver": "^5.5.0",
"spellchecker": "github:mobitar/node-spellchecker",
"standard-notes-web": "3.0.3"
"standard-notes-web": "3.0.4-beta2"
}
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "standard-notes",
"main": "./app/dist/index.js",
"version": "3.0.3",
"version": "3.0.4-beta2",
"license": "AGPL-3.0-or-later",
"devDependencies": {
"babel-cli": "^6.26.0",
Expand Down

0 comments on commit e9c247f

Please sign in to comment.