Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Unable to call continue with a key argument #19

Closed
pixelcort opened this Issue Aug 13, 2012 · 0 comments

Comments

Projects
None yet
2 participants
Contributor

pixelcort commented Aug 13, 2012

Let's say I've created the following IndexedDB database (using jquery.indexeddb):

$.indexedDB('helloworld', {
  version: 1,
  upgrade: function(transaction) {
    var items = transaction.createObjectStore('items', {
      autoIncrement: false,
      keypath: 'id'
    });
    setTimeout(function() {
      var letters = 'abcdefghijklmnopqrstuvwxyz'.split('');
      for (var i=0,l=letters.length;i<l;i++) {
        var letter = letters[i];
        items.put({id:letter}, letter);
      }
    },1);
  }
});

Then I use a cursor to walk the alphabet (using native IndexedDB APIs):

var request = indexedDB.open('helloworld');
request.onsuccess=(function(event){
  db = request.result;

  var transaction = db.transaction(['items'], 'readwrite');
  var itemsObjectStore = transaction.objectStore('items');

  itemsObjectStore.openCursor().onsuccess = function(event) {
    var cursor = event.target.result;

    if (cursor) {
      console.log('cursor.key: '+cursor.key);
      if (cursor.key === 'g') {
        cursor.continue('w');
      } else {
        cursor.continue();
      }
    }
  };
});

In Firefox (without using the shim) I get console output from a to g, then from w to z.

In Safari (using the shim) I only get console output from a to g.

It appears there is code in the shim that attempts to handle a key argument to the custom.continue, but it doesn't appear to be working. In addition, there doesn't appear to be any code in the shim that would attempt to handle calling continue without a key after calling it previously with a key. (I.E. offsetting from the last key continued from.)

@axemclion axemclion closed this in 8a2f4ef Aug 20, 2012

axemclion added a commit that referenced this issue Aug 20, 2012

Merge pull request #24 from pixelcort/fix19
Fix #19 get continue working when providing key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment