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 {
|
2019-02-10 21:25:29 +01:00
|
|
|
constructor(idbStore) {
|
|
|
|
super(idbStore);
|
2019-02-05 00:21:50 +01:00
|
|
|
}
|
|
|
|
|
2019-02-10 21:25:29 +01:00
|
|
|
get _idbStore() {
|
2019-02-07 01:20:27 +01:00
|
|
|
return this._target;
|
2019-02-05 00:21:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
index(indexName) {
|
2019-02-10 21:25:29 +01:00
|
|
|
return new QueryTarget(this._idbStore.index(indexName));
|
2019-02-07 01:20:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
put(value) {
|
2019-02-10 21:25:29 +01:00
|
|
|
return reqAsPromise(this._idbStore.put(value));
|
2019-02-07 01:20:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
add(value) {
|
2019-02-10 21:25:29 +01:00
|
|
|
return reqAsPromise(this._idbStore.add(value));
|
2019-02-05 00:21:50 +01:00
|
|
|
}
|
|
|
|
}
|