Skip to content

Commit 04a2f37

Browse files
rmobisParashuram
authored andcommitted
Fixed typo on IDBCursor.NEXT
Also added a few semicolons and removed some unecessary ones, and fixed some theoretically out of scope variables.
1 parent 202e05c commit 04a2f37

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

jquery.indexeddb.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
var IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
44
var IDBCursor = window.IDBCursor || window.webkitIDBCursor;
55
IDBCursor.PREV = IDBCursor.PREV || "prev";
6-
IDBCursor.NEXT = IDBCursor.PREV || "next";
6+
IDBCursor.NEXT = IDBCursor.NEXT || "next";
77

88
/**
99
* Best to use the constant IDBTransaction since older version support numeric types while the latest spec
@@ -66,8 +66,9 @@
6666
if (typeof idbRequest.onblocked !== "undefined" && idbRequest.onblocked === null) {
6767
idbRequest.onblocked = function(e){
6868
console.log("Blocked", idbRequest, e, this);
69+
var res;
6970
try {
70-
var res = idbRequest.result;
71+
res = idbRequest.result;
7172
} catch (e) {
7273
res = null; // Required for Older Chrome versions, accessing result causes error
7374
}
@@ -126,7 +127,7 @@
126127
return wrap.request(function(args){
127128
return idbObjectStore[op].apply(idbObjectStore, args);
128129
}, arguments);
129-
}
130+
};
130131
})(crudOps[i]);
131132
}
132133

@@ -148,7 +149,7 @@
148149

149150
result.createIndex = function(prop, options, indexName){
150151
if (arguments.length === 2 && typeof options === "string") {
151-
indexName = arguments[1]
152+
indexName = arguments[1];
152153
options = null;
153154
}
154155
if (!indexName) {
@@ -161,7 +162,7 @@
161162

162163
result.deleteIndex = function(indexName){
163164
return idbObjectStore.deleteIndex(indexName);
164-
}
165+
};
165166

166167
return result;
167168
},
@@ -232,7 +233,7 @@
232233
dfd.rejectWith(cursorReq, [cursorReq.result, e]);
233234
};
234235
} catch (e) {
235-
console.log("An exception occured inside cursor", cursorReq, e)
236+
console.log("An exception occured inside cursor", cursorReq, e);
236237
e.type = "exception";
237238
dfd.rejectWith(cursorReq, [null, e]);
238239
}
@@ -282,7 +283,7 @@
282283
}
283284
};
284285
}
285-
}
286+
};
286287

287288
////////////////////////////////////////////////////////////////////////////////////////////////////
288289

@@ -397,7 +398,7 @@
397398
};
398399

399400
return result;
400-
}
401+
};
401402

402403

403404
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -465,9 +466,10 @@
465466
mode = getDefaultTransaction(mode);
466467
return $.Deferred(function(dfd){
467468
dbPromise.then(function(db, e){
469+
var idbTransaction;
468470
try {
469471
console.log("DB Opened, now trying to create a transaction", storeNames, mode);
470-
var idbTransaction = db.transaction(storeNames, mode);
472+
idbTransaction = db.transaction(storeNames, mode);
471473
console.log("Created a transaction", idbTransaction, mode, storeNames);
472474
idbTransaction.onabort = idbTransaction.onerror = function(e){
473475
dfd.rejectWith(idbTransaction, [e]);
@@ -556,7 +558,7 @@
556558
} : mode);
557559
console.log("Object store created", storeName, db);
558560
} catch (ex) {
559-
console.log("Exception when trying ot create a new object store", ex)
561+
console.log("Exception when trying ot create a new object store", ex);
560562
dfd.rejectWith(this, [ex, e]);
561563
}
562564
}
@@ -570,7 +572,7 @@
570572
onTransactionProgress(trans, callback);
571573
});
572574
});
573-
};
575+
}
574576

575577
function crudOp(opName, args){
576578
return op(function(wrappedObjectStore){
@@ -590,7 +592,7 @@
590592
result[crud[i]] = (function(op){
591593
return function(){
592594
return crudOp(op, arguments);
593-
}
595+
};
594596
})(crud[i]);
595597
}
596598

@@ -609,7 +611,7 @@
609611
return indexOp("getKey", indexName, [key]);
610612
}
611613
};
612-
}
614+
};
613615

614616
return result;
615617
}

0 commit comments

Comments
 (0)