fix: remove/clear is not async

This commit is contained in:
thecodrr
2020-02-20 12:11:16 +05:00
parent 22f0260c37
commit 389e4612db
3 changed files with 6 additions and 6 deletions

View File

@@ -35,7 +35,7 @@ export default class Trash {
for (let id of ids) { for (let id of ids) {
if (!this.collection.exists(id)) return; if (!this.collection.exists(id)) return;
if (id.indexOf("note") > -1) if (id.indexOf("note") > -1)
this.deltaStorage.remove(id.replace("_deleted", "") + "_delta"); await this.deltaStorage.remove(id.replace("_deleted", "") + "_delta");
await this.collection.removeItem(id); await this.collection.removeItem(id);
} }
} }

View File

@@ -51,7 +51,7 @@ export default class CachedCollection {
async removeItem(id) { async removeItem(id) {
if (this.transactionOpen) return; if (this.transactionOpen) return;
if (this.map.delete(id)) { if (this.map.delete(id)) {
this.indexer.remove(id); await this.indexer.remove(id);
await this.indexer.deindex(id); await this.indexer.deindex(id);
} }
} }

View File

@@ -9,11 +9,11 @@ export default class Storage {
let data = await this.storage.read(key); let data = await this.storage.read(key);
return data; return data;
} }
clear() { async clear() {
this.storage.clear(); await this.storage.clear();
} }
remove(key) { async remove(key) {
this.storage.remove(key); await this.storage.remove(key);
} }
encrypt(password, data) { encrypt(password, data) {
return this.storage.encrypt(password, data); return this.storage.encrypt(password, data);