You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
* Implement "show all notes" feature. * Ensure middleware is completely flushed and shutdown before continuing tests.
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user