Use native IndexedDB APIs for findTagForTitle

This commit is contained in:
toasted-nutbread 2019-10-19 13:41:18 -04:00
parent 610c2b9cca
commit 96e4bf1735

View File

@ -182,7 +182,12 @@ class Database {
this.validate();
let result = null;
await this.db.tagMeta.where('name').equals(name).each(row => {
const db = this.db.backendDB();
const dbTransaction = db.transaction(['tagMeta'], 'readonly');
const dbTerms = dbTransaction.objectStore('tagMeta');
const dbIndex = dbTerms.index('name');
const only = IDBKeyRange.only(name);
await Database.getAll(dbIndex, only, null, row => {
if (title === row.dictionary) {
result = row;
}