javascript - HTML5 How to tell when IndexedDB cursor is at end -


i iterating thru indexeddb data store, adding data javascript array. how can tell when cursor @ end, can sort array , act on it?

onsuccess called when row has been retrieved cursor - there callback when entire cursor has been navigated?

the result (event.target.result) of successful cursor request either cursor object or null.

if event.target.result set, it's cursor, , can access event.target.result.value. can call event.target.result.continue() go on next object, if any.

if event.target.result not set, there no more objects.

for illustration, code project of mine:

  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)     } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -