mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-27 09:29:59 -04:00
Add capability guards for the database functionality.
This commit is contained in:
parent
65736aa278
commit
a8ceb3b194
3
js/db.js
3
js/db.js
@ -24,6 +24,9 @@ define(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Capable: function() {
|
||||||
|
return typeof indexedDB != "undefined";
|
||||||
|
},
|
||||||
// Turn on/off debug logging.
|
// Turn on/off debug logging.
|
||||||
ToggleDebug: function() {
|
ToggleDebug: function() {
|
||||||
this.debug = !this.debug;
|
this.debug = !this.debug;
|
||||||
|
@ -12,7 +12,7 @@ define(
|
|||||||
// callbacks.error is expected to be a function that takes
|
// callbacks.error is expected to be a function that takes
|
||||||
// an IDBRequest as an argument.
|
// an IDBRequest as an argument.
|
||||||
UpdateTags: function(ref, tags, callbacks) {
|
UpdateTags: function(ref, tags, callbacks) {
|
||||||
db.Transaction(
|
db.Capable() && db.Transaction(
|
||||||
[tagStore], function(trans) {
|
[tagStore], function(trans) {
|
||||||
db.Update(
|
db.Update(
|
||||||
'tags', ref.toString(),
|
'tags', ref.toString(),
|
||||||
@ -27,7 +27,7 @@ define(
|
|||||||
// callbacks.error is expected to be a function that takes
|
// callbacks.error is expected to be a function that takes
|
||||||
// an IDBRequest as an argument.
|
// an IDBRequest as an argument.
|
||||||
GetTags: function(ref, callbacks) {
|
GetTags: function(ref, callbacks) {
|
||||||
db.Get(tagStore, ref.toString(),
|
db.Capable() && db.Get(tagStore, ref.toString(),
|
||||||
{success: function(req) {
|
{success: function(req) {
|
||||||
var data = req.target.result;
|
var data = req.target.result;
|
||||||
// TODO suppport book and chapter indexes for
|
// TODO suppport book and chapter indexes for
|
||||||
|
Loading…
x
Reference in New Issue
Block a user