The result ( event.target.result ) of a successful cursor query is either a cursor object or null.
If event.target.result set, this is the cursor, and you can access event.target.result.value . You can then call event.target.result.continue() to move on to the next object, if any.
If event.target.result not specified, then there are no more objects.
To illustrate, the code from my project:
var collectObjects = function (request, cb) { var objects = [] request.onsuccess = function (event) { if (!event.target.result) return cb(null, objects) cursor = event.target.result objects.push(cursor.value) cursor.continue() } request.onerror = function (event) { cb(event.target.error) }
source share