Skip to content

Commit

Permalink
offer write access during iterate
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Arps committed Nov 24, 2011
1 parent 51c0c81 commit b19ab0d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions IDBStore.js
Expand Up @@ -276,22 +276,22 @@
**********/

iterate: function(callback, options){
options || (options = {});
options = mixin({
index: null,
order: 'ASC',
filterDuplicates: false,
keyRange: null,
writeAccess: false,
onEnd: null,
onError: function(error) { console.error('Could not open cursor.', error); }
}, options);
}, options || {});

var directionType = options.order.toLowerCase() == 'desc' ? 'PREV' : 'NEXT';
if(options.filterDuplicates){
directionType += '_NO_DUPLICATE';
}

var cursorTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
var cursorTransaction = this.db.transaction([this.storeName], this.consts[options.writeAccess ? 'READ_WRITE' : 'READ_ONLY']);
var cursorTarget = cursorTransaction.objectStore(this.storeName);
if(options.index){
cursorTarget = cursorTarget.index(options.index);
Expand Down

0 comments on commit b19ab0d

Please sign in to comment.