1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Desktop: Resolves #262: Implement "show all notes" (#2472)

* Implement "show all notes" feature.

* Ensure middleware is completely flushed and shutdown before continuing tests.
This commit is contained in:
mic704b
2020-02-22 22:25:16 +11:00
committed by GitHub
parent 0f28060795
commit fbedc6b29b
15 changed files with 344 additions and 16 deletions

View File

@ -16,6 +16,8 @@ class DecryptionWorker {
this.eventEmitter_ = new EventEmitter();
this.kvStore_ = null;
this.maxDecryptionAttempts_ = 2;
this.startCalls_ = [];
}
setLogger(l) {
@ -92,7 +94,7 @@ class DecryptionWorker {
this.dispatch(action);
}
async start(options = null) {
async start_(options = null) {
if (options === null) options = {};
if (!('masterKeyNotLoadedHandler' in options)) options.masterKeyNotLoadedHandler = 'throw';
if (!('errorHandler' in options)) options.errorHandler = 'log';
@ -238,6 +240,27 @@ class DecryptionWorker {
this.scheduleStart();
}
}
async start(options) {
this.startCalls_.push(true);
try {
await this.start_(options);
} finally {
this.startCalls_.pop();
}
}
async cancelTimers() {
if (this.scheduleId_) clearTimeout(this.scheduleId_);
return new Promise((resolve) => {
const iid = setInterval(() => {
if (!this.startCalls_.length) {
clearInterval(iid);
resolve();
}
}, 100);
});
}
}
module.exports = DecryptionWorker;