Clean queue after sending
This commit is contained in:
parent
1c3116d9dc
commit
dfd6260a7a
3 changed files with 49 additions and 16 deletions
|
|
@ -396,6 +396,23 @@ class SimpleNodeStore {
|
|||
}
|
||||
})
|
||||
}//}}}
|
||||
async delete(keys) {//{{{
|
||||
const store = this.db
|
||||
.transaction(['nodes', this.storeName], 'readwrite')
|
||||
.objectStore(this.storeName)
|
||||
|
||||
const promises = []
|
||||
for (const key of keys) {
|
||||
const p = new Promise((resolve, reject)=>{
|
||||
// TODO - implement a way to add an error to a page-global error log.
|
||||
const request = store.delete(key)
|
||||
request.onsuccess = (event)=>resolve(event)
|
||||
request.onerror = (event)=>reject(event)
|
||||
})
|
||||
promises.push(p)
|
||||
}
|
||||
return Promise.all(promises)
|
||||
}//}}}
|
||||
}
|
||||
|
||||
// vim: foldmethod=marker
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue