21 lines
440 B
JavaScript
21 lines
440 B
JavaScript
// helper functions that help compress the code better
|
|
|
|
function callStore (store, method, key, cb) {
|
|
store[method](key).onsuccess = e => (cb && cb(e.target.result))
|
|
}
|
|
|
|
export function getIDB (store, key, cb) {
|
|
callStore(store, 'get', key, cb)
|
|
}
|
|
|
|
export function getAllIDB (store, key, cb) {
|
|
callStore(store, 'getAll', key, cb)
|
|
}
|
|
|
|
export function commit (txn) {
|
|
/* istanbul ignore else */
|
|
if (txn.commit) {
|
|
txn.commit()
|
|
}
|
|
}
|