This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

continue

Summary

Moves to the next record, or to the record specified by a key.

Method of apis/indexeddb/IDBCursorapis/indexeddb/IDBCursor

Syntax

var hasMoved = cursor.continue(key);

Parameters

key

Data-type
String

(Optional)

The next key to position this cursor at.

If the key parameter is specified and fulfills any of these conditions this method must throw a DOMException of type DataError:

  • The parameter is not a valid key.
  • The parameter is less than or equal to this cursor’s position and this cursor’s direction is “next” or "nextunique".
  • The parameter is greater than or equal to this cursor’s position and this cursor’s direction is “prev” or "prevunique".

Return Value

Returns an object of type BooleanBoolean

If the steps for synchronously executing a request returns a cursor, then this function returns true. Otherwise this function returns false.

Examples

var tx = db.transaction('Contact');
var store = tx.objectStore('Contact');
var cursor = store.openCursor();
while(cursor.continue()) {
    var value = cursor.value;
    // act on each object or key
}

View live example

Usage

 The continue method throws an exception if
  • The transaction this IDBCursor belongs to is not active.
  • The cursor is currently being iterated, or has iterated past its end.
  • The key parameter was specified but did not contain a valid key.

Related specifications

W3C IndexedDB Specification
W3C Proposed Recommendation

Attributions