vector-im-hydrogen-web/src/storage/idb/store.js

24 lines
433 B
JavaScript
Raw Normal View History

2019-02-05 00:21:50 +01:00
import QueryTarget from "./query-target.js";
2019-02-07 01:20:27 +01:00
import { reqAsPromise } from "./utils.js";
2019-02-05 00:21:50 +01:00
export default class Store extends QueryTarget {
constructor(store) {
2019-02-07 01:20:27 +01:00
super(store);
2019-02-05 00:21:50 +01:00
}
2019-02-07 01:20:27 +01:00
get _store() {
return this._target;
2019-02-05 00:21:50 +01:00
}
index(indexName) {
2019-02-07 01:20:27 +01:00
return new QueryTarget(this._store.index(indexName));
}
put(value) {
return reqAsPromise(this._store.put(value));
}
add(value) {
return reqAsPromise(this._store.add(value));
2019-02-05 00:21:50 +01:00
}
}