Skip to content

Commit ef3425d

Browse files
committed
fix broken backup after changes to stop operlapping operations (fix #3879)
1 parent 33a217f commit ef3425d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

backup.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ function bangleUpload() {
7272
type:"arraybuffer",
7373
mimeType:".zip,application/zip"}, function(data) {
7474
if (data===undefined) return;
75-
var promise = Promise.resolve();
7675
var zip = new JSZip();
7776
var cmds = "";
78-
zip.loadAsync(data).then(function(zip) {
77+
return zip.loadAsync(data).then(function(zip) {
7978
return showPrompt("Restore from ZIP","Are you sure? This will overwrite existing apps");
8079
}).then(()=>{
8180
Progress.show({title:`Reading ZIP`});
81+
var promise = Promise.resolve();
8282
zip.forEach(function (path, file){
8383
console.log("path");
8484
promise = promise
@@ -124,16 +124,14 @@ function bangleUpload() {
124124
showToast('Restore failed, ' + err, 'error');
125125
resolve();
126126
});
127-
return promise;
128-
});
129-
}
127+
}));
130128
}
131129

132130
window.addEventListener('load', (event) => {
133131
document.getElementById("downloadallapps").addEventListener("click",event=>{
134-
startOperation({name:"Backup Apps"}, () => bangleDownload);
132+
startOperation({name:"Backup Apps"}, () => bangleDownload());
135133
});
136134
document.getElementById("uploadallapps").addEventListener("click",event=>{
137-
startOperation({name:"Restore Apps"}, () => bangleUpload);
135+
startOperation({name:"Restore Apps"}, () => bangleUpload());
138136
});
139137
});

0 commit comments

Comments
 (0)