added progress also to export

This commit is contained in:
zadam
2019-02-10 22:30:55 +01:00
parent a097cefba7
commit 6be8a3f343
14 changed files with 147 additions and 35 deletions

View File

@@ -16,19 +16,20 @@ class ImportContext {
// importId is to distinguish between different import events - it is possible (though not recommended)
// 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.lastSentCountTs = Date.now();
}
async increaseCount() {
async increaseProgressCount() {
this.count++;
if (Date.now() - this.lastSentCountTs >= 1000) {
if (Date.now() - this.lastSentCountTs >= 200) {
this.lastSentCountTs = Date.now();
await messagingService.sendMessageToAllClients({
importId: this.importId,
type: 'import-note-count',
type: 'import-progress-count',
count: this.count
});
}