A functional approach to work with IndexDB.
It uses heavily data.task to provide a better promise composition.
const configDB = {
name: "test",
version: 24
};
Perform a query
using a store
on the config
database.
idb.withDB(
configDB,
idb.storeRW('contacts'),
idb.selectWhere('name', 'eman')
).fork(
err => {
console.log("error", err);
},
succ => {
console.log("success", succ.results);
}
);
idb.withDB(
configDB,
idb.storeRO('contacts'),
idb.selectAll()
).fork(
err => {
console.log("error", err);
},
succ => {
console.log("success", succ.results);
}
);
idb.withDB(
configDB,
idb.storeRO('contacts'),
idb.selectWhere('name', 'eman')
).fork(
err => {
console.log("error", err);
},
succ => {
console.log("success", succ.results);
}
);
idb.withDB(
configDB,
idb.storeRW('contacts'),
idb.insert({ name: 'eman' })
).fork(
err => {
console.log("error", err);
},
succ => {
console.log("success", succ.results);
}
);
idb.withDB(
configDB,
idb.storeRW('contacts'),
idb.update({ id: 3, name: 'eman' })
).fork(
err => {
console.log("error", err);
},
succ => {
console.log("success", succ.results);
}
);
idb.withDB(
configDB,
idb.storeRW('contacts'),
idb.update({ id: 3, name: 'eman' })
).fork(
err => {
console.log("error", err);
},
succ => {
console.log("success", succ.results);
}
);
See license.md
.