prettier progress count

This commit is contained in:
zadam
2019-02-10 22:56:14 +01:00
parent 8aa7e2d0a0
commit caa7dd9619
7 changed files with 25 additions and 26 deletions

View File

@@ -17,20 +17,20 @@ class ImportContext {
// to have multiple imports going at the same time
this.importId = importId;
// // count is mean to represent count of exported notes where practical, otherwise it's just some measure of progress
this.count = 0;
this.progressCount = 0;
this.lastSentCountTs = Date.now();
}
async increaseProgressCount() {
this.count++;
this.progressCount++;
if (Date.now() - this.lastSentCountTs >= 200) {
if (Date.now() - this.lastSentCountTs >= 500) {
this.lastSentCountTs = Date.now();
await messagingService.sendMessageToAllClients({
importId: this.importId,
type: 'import-progress-count',
count: this.count
progressCount: this.progressCount
});
}
}