mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-25 16:29:49 -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.
|
||||
ToggleDebug: function() {
|
||||
this.debug = !this.debug;
|
||||
|
@ -12,7 +12,7 @@ define(
|
||||
// callbacks.error is expected to be a function that takes
|
||||
// an IDBRequest as an argument.
|
||||
UpdateTags: function(ref, tags, callbacks) {
|
||||
db.Transaction(
|
||||
db.Capable() && db.Transaction(
|
||||
[tagStore], function(trans) {
|
||||
db.Update(
|
||||
'tags', ref.toString(),
|
||||
@ -27,7 +27,7 @@ define(
|
||||
// callbacks.error is expected to be a function that takes
|
||||
// an IDBRequest as an argument.
|
||||
GetTags: function(ref, callbacks) {
|
||||
db.Get(tagStore, ref.toString(),
|
||||
db.Capable() && db.Get(tagStore, ref.toString(),
|
||||
{success: function(req) {
|
||||
var data = req.target.result;
|
||||
// TODO suppport book and chapter indexes for
|
||||
|
Loading…
x
Reference in New Issue
Block a user