aboutsummaryrefslogtreecommitdiff
path: root/lib/wallet/query.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-11-13 10:17:39 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-11-13 10:17:39 +0100
commiteb84d5747aac0de781d64fb9cdbf2da13006d85e (patch)
tree387d7711e177d151a185e2a9a870c39cc03926ce /lib/wallet/query.ts
parentb2128609ac8159a14224deba399144b3400c8c20 (diff)
downloadwallet-core-eb84d5747aac0de781d64fb9cdbf2da13006d85e.tar.xz
fix small react issues
Diffstat (limited to 'lib/wallet/query.ts')
-rw-r--r--lib/wallet/query.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/wallet/query.ts b/lib/wallet/query.ts
index c172bbeb7..08e270ea6 100644
--- a/lib/wallet/query.ts
+++ b/lib/wallet/query.ts
@@ -423,6 +423,22 @@ export class QueryRoot implements PromiseLike<void> {
}
+ putWithResult<T>(store: Store<T>, val: T): Promise<IDBValidKey> {
+ const {resolve, promise} = openPromise();
+ let doPutWithResult = (tx: IDBTransaction) => {
+ let req = tx.objectStore(store.name).put(val);
+ req.onsuccess = () => {
+ resolve(req.result);
+ }
+ this.scheduleFinish();
+ };
+ this.addWork(doPutWithResult, store.name, true);
+ return Promise.resolve()
+ .then(() => this.finish())
+ .then(() => promise);
+ }
+
+
mutate<T>(store: Store<T>, key: any, f: (v: T) => T): QueryRoot {
let doPut = (tx: IDBTransaction) => {
let reqGet = tx.objectStore(store.name).get(key);